473,379 Members | 1,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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

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
4 1179
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
* 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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Paul | last post by:
In real life situation, do we ever come across a situation where we would need two base objects in an object. A snippet is worth 1000 words (: so... class Base { }; class Derived1:public Base...
10
by: Bhan | last post by:
Using Ptr of derived class to point to base class and viceversa class base { .... } class derived : public base { .... }
4
by: Rachel Devons | last post by:
All, I'm struggling with an OOP concept. Let me try to define what I'm wanting by using some classic examples. Let's say that I have classes called Square & Circle that derive from class...
2
by: Oenone | last post by:
I could use a little advice to help prevent me making a possible mess of a project. :) In VB6, I once created a project that exposed a public interface class. I then Implemented this in various...
9
by: Sean Kirkpatrick | last post by:
To my eye, there doesn't seem to be a whole lot of difference between the two of them from a functional point of view. Can someone give me a good explanation of why one vs the other? Sean
1
by: D Witherspoon | last post by:
Coming up with a scenario here. For example there is the standard .NET MailMessage class. I am creating a project (let's call it CommonBase) that has the following 2 classes ...
3
by: Goran Djuranovic | last post by:
Hi all, Is there a way to retrieve a derived class name inside a subroutine or a function of the base class? I am trying to get some data from the database, based on which derived class is calling...
2
by: cmonthenet | last post by:
Hello, I searched for an answer to my question and found similar posts, but none that quite addressed the issue I am trying to resolve. Essentially, it seems like I need something like a virtual...
3
by: Ravi | last post by:
Is this the correct way to think of "base class"? The "base class" is a class from which other classes are derived. The "base class" will never be derived from another class.
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.