Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
A Derived Class is often larger than and more general than its base class.


This True of False
I Solved It False Am I right or not ?!!
Posted

False as base class is parent and more general.

You were right, but next time, do add the reason on why you think so.
 
Share this answer
 
Comments
[no name] 4-Jan-13 14:04pm    
*****
Sergey Alexandrovich Kryukov 4-Jan-13 17:03pm    
Well, the question is incorrect, so, strictly speaking, any answer makes no sense. In certain way, "false" is better then "true", but this is not really a "good" answer.
I explain it in my answer, please see.
—SA
This is a totally incorrect question. It has two different and unrelated statement in it. The derived class it usually larger, that's true (only usually, not always, and only in certain sense, please see below), but normally not more general, but just the opposite, more specialized. It cannot be answered by one true or false.

So, correct answer is: the question makes no sense, by the reason explained above.

To be more precise: a relationship "larger" is not defined for classes. When I said "larger" above, I rather meant: if you create instance of the base class and instance of the derived class, it's pretty usual that the first one takes less memory; however, it's easy to design the sample where things are the opposite. This statement is based on simple fact that the derived class has all members of the base class and possibly something else. But! with less number of members you can get more memory than with more members. For example, you can initialize a long string in base class, make it much shorted in derived class but add more members. Then base class is larger. You can invent some other meanings of the relationship "larger", based in common English. It does not mean it has strict sense. Asking such questions is just dishonest.

I suspect this is the interview question. I also suspect it is invented by people who very purely understand the essence things. Again! If you go for interviews, you face too many morons, unfortunately.

—SA
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900