C++ Overriding Base Class Methods in Derived Class | Cpp

  c++

Email

/* this method over wring class*/
#include<iostream>

using namespace std;

class Father
{

public :

void setanil()
{

cout << “this is main class of the coding “;

}

};

class Mother : public Father{

public :

void setanil()
{
cout << “this mohter class values of the coding”;
}
};

int main()
{
Mother anil;
anil.setanil();
}

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of