pls answer this... A class that has a protected constructor:
a. cannot be used as a base class
b. results in read-only objects
c. must have a virtual destructor
d. none of the above
which letter is correct? thanks!
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
c or d.
AFAIK there is no rule in the C++ language that says "If Thou Maketh A Class With A Protected Constructor, Thine Destructor Must Be Virtual", but since a class with a protected constructor is most likely an ADT from which you are deriving other useful classes, it is probably a good idea.
AFAIK there is no rule in the C++ language that says "If Thou Maketh A Class With A Protected Constructor, Thine Destructor Must Be Virtual", but since a class with a protected constructor is most likely an ADT from which you are deriving other useful classes, it is probably a good idea.
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
www.digitalfiends.com
hehe, sure, it''s a 60 item test, anyway pls, i want a sure answer, anyone?
http://www.dualforcesolutions.comProfessional website designs and development, customized business systems, etc.,
Well it''s a crap question. There is no requirement in the C++ language that a class with a protected constructor should have a virtual destructor, but in 99% of cases it is common sense. (off the top of my head, I can''t think of any cases where it isn''t common sense, can anyone else?)
So the correct answer depends on your teacher. If he is
a) a tosser who learnt C++ from ''Teach Yourself C++ in 21 days'' and is giving you questions directly out of the book, then the answer is probably c.
or
b) a tosser who actually knows and understands the syntax, but wants to ask you a trick question. In this case, the answer is d.
I''d put my money on c, even though technically d is the correct answer.
So the correct answer depends on your teacher. If he is
a) a tosser who learnt C++ from ''Teach Yourself C++ in 21 days'' and is giving you questions directly out of the book, then the answer is probably c.
or
b) a tosser who actually knows and understands the syntax, but wants to ask you a trick question. In this case, the answer is d.
I''d put my money on c, even though technically d is the correct answer.
There''s nothing wrong with TYSC++I21D - it just has a bad title.
Once there was a time when all people believed in God and the church ruled. This time is called the Dark Ages.
Once there was a time when all people believed in God and the church ruled. This time is called the Dark Ages.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
How about
e) Is used to create Singleton classes.
e) Is used to create Singleton classes.
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement