January 14th, 2004, 06:09 AM
When to define a common base class
This is more a general OO question, but I was wondering when to define a base class and when not to. For instance, I have a couple of classes (not derived), all with a few common attributes but no common operations and also a lot of specific attributes. Also, I do not think these classes are subject to very much change. I can imagine that in a case where two classes only have one common attribute, that it would make no sense defining a base class.
I read somewhere here on codeguru that it is not wise to automatically derive your classes in MFC from CObject because of the overhead. So I was wondering wether deriving a class in C++ has negative impact on the speed of your application and that it is faster to have seperate, unrelated classes. Or is this neglectable. I realize that there is probably not a clear guideline, but I was just curious about your opinions.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.