https://www.geeksforgeeks.org/polymorphism-in-c/
In function overriding in c++, how can I print the base class non-virtual member function from the derived class function using the derived class obj
https://www.geeksforgeeks.org/polymorphism-in-c/
In function overriding in c++, how can I print the base class non-virtual member function from the derived class function using the derived class obj
You can always call the base class function from derived class. For example:
class parent
{
public:
virtual void print()
{
std::cout << "base class" << std::endl;
}
};
class child: parent
{
public:
void print()
{
parent::print();
std::cout << "child class" << std::endl;
}
};
int main(int argc, char *argv[])
{
child c;
c.print();
return 0;
}