I don't know much about c++, but I would like to correct one thing from the Java perspective:
A Mercedes can be referenced as a Car, like so:
Car car = new Mercedes();
However, without...
Type: Posts; User: KevinWorkman
I don't know much about c++, but I would like to correct one thing from the Java perspective:
A Mercedes can be referenced as a Car, like so:
Car car = new Mercedes();
However, without...
Yes, you are. That's the point. The compiler has no way to know what you're storing in the superclass variable. It has no way to know what methods the subclasses are going to have. So even though you...
Okay. I still had to fix your method declarations, but good enough.
The reason it's saying that the add() method is not defined in type A is because, well, it isn't. And your 'a' variable is of...
Like I said. We can help you when you provide an SSCCE. Talking in theory is fine, but it is a thousand times easier when we have some common working code to which we can refer. Plus that code...
I just counted 20 compiler errors in that code. Are you sure everything works how you think it does? Fix them and create an SSCCE that demonstrates what you're talking about, and we'll go from there.