Hello friends, in this post today, we learn about what is function overriding in c++. so lets start...
![]() |
Function overriding in c++ |
Function overriding:-
In function overriding we write the same function which is defined in base class, we write the same function in derived class with same parameter is known as function overriding.
If base class and derived class have member functions with same name and arguments.
If you create an object of derived class and write code to access that member function then, the member function in derived class is only invokes.
Means the member function of derived class overrides the member function of base class. This is called function overriding or method overriding in C++.
Example:
Output:-
I hope that whatever information I have given in this post today, you have liked it and you have understood it.so keep learning and wait for the next post that will help you to increase your knowledge with something new information .
Thank you so much for reading. And take care about yourself and your family.
Comments
Post a Comment