By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,443 Members | 1,409 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,443 IT Pros & Developers. It's quick & easy.

Can base class have the net sum of all the interfaces of its derived classes?

P: n/a
Vj
Hi all,

I am contemplating a design wherein most functions in my base
class are virtual and says "request_not_supported". My derived classes
override only the functions they support. In net effect, my base class
always has the sum of all the I/Fs of my derived classes. My friend
disagrees with me saying that derived classes are always supposed to be
"base class ++". Is there any mistake in my approach? Kindly let me
know if I'm violating any OOPS concepts.
R
V

Dec 19 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Dec 19, 2:48 pm, "Vj" <vijay.rajamanic...@gmail.comwrote:
Hi all,

I am contemplating a design wherein most functions in my base
class are virtual and says "request_not_supported". My derived classes
override only the functions they support. In net effect, my base class
always has the sum of all the I/Fs of my derived classes. My friend
disagrees with me saying that derived classes are always supposed to be
"base class ++". Is there any mistake in my approach? Kindly let me
know if I'm violating any OOPS concepts.
Your approach is just fine, and for some situations better than adding
more functions to the derived classes. It all depends on how you expect
to use the classes. Notice though that it might be a better idea to
make the base purely virtual so that you can't create an instance of it
if it's not going to have any meaningful usage anyway.

--
Erik Wikström

Dec 19 '06 #2

P: n/a
* Vj:
[off-topic, trolling]
Please disappear.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Dec 19 '06 #3

P: n/a
On 19 Dec 2006 05:48:15 -0800 in comp.lang.c++, "Vj"
<vi****************@gmail.comwrote,
>disagrees with me saying that derived classes are always supposed to be
"base class ++". Is there any mistake in my approach? Kindly let me
know if I'm violating any OOPS concepts.
Google for "Liskov substitution principle". After reading the results
of that, please take further questions of this type to comp.object,
there is nothing C++ specific about it.

Dec 19 '06 #4

P: n/a
On 19 Dec 2006 05:48:15 -0800 in comp.lang.c++, "Vj"
<vi****************@gmail.comwrote,
>disagrees with me saying that derived classes are always supposed to be
"base class ++". Is there any mistake in my approach? Kindly let me
know if I'm violating any OOPS concepts.
Google for "Liskov substitution principle", which is the common name for
your friend's argument. After reading the results of that, please take
further questions of this type to comp.object, there is nothing C++
specific about it.

Dec 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.