- #1
- 2,795
- 21
I just came across another question while brushing up on my c++.
If you have a base class that uses virtual methods, when you try to use it to define a derived class then you *need* to prefix the base class name with "public", as in the following example.
Ok ignore the ">>><<<" and the capitals, it is of course just a plain lower case "public", I just wanted to highlight it so readers could easily see what I was referring to.
We do we need that?
If you have a base class that uses virtual methods, when you try to use it to define a derived class then you *need* to prefix the base class name with "public", as in the following example.
Code:
class ExampleBaseClass {
...
virtual void ExamlpeVirtualMemberFunction();
...
}
class ExampleDerivedClass: >>>>PUBLIC<<<< ExampleBaseClass {
void ExampleVirtualMemberFunction(); //overrides base class
}
Ok ignore the ">>><<<" and the capitals, it is of course just a plain lower case "public", I just wanted to highlight it so readers could easily see what I was referring to.
We do we need that?