In my deisgn I have three classes derived (Der1,Der2,Der3)from a common class (Base1)
in 2/3 of these classes have same implementation forvirtual function f1().
i.e f1() shares same implementaion for Der1, Der2 . and NO IMPLEMENTATION for Der3.
so I kept f1() implementation in base class Base1, and in Der3 I overrided thsi implementation with NULL IMPLEMTNATION ( {} )
Is this OK ?

Recommended Answers

All 2 Replies

Why dont you just keep the implementation in Der1 and Der2 instead in base class? That will make more sense i guess

Put a class with f1(),in between Base1(with no f1()) and Dev1 and Dev2. Dev3 still derive from Base1.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.