








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An explanation of overriding and overloading member functions of base classes in object-oriented programming (oop). Overloading is done within the scope of one class, while overriding is done in the scope of both parent and child classes. The document also includes examples of overriding member functions and their impact on the output.
Typology: Slides
1 / 14
This page cannot be seen from the preview
Don't miss anything!









Derive class can override member function
Derive class can override member function
of base class such that the working of
of base class such that the working of
function is totally changed function is totally changed
Derive class can override member function
Derive class can override member function
of base class such that the working of
of base class such that the working of
function
function is similar
is similar to former implementation
to former implementation
class Student : public Person{
class Student : public Person{
char * major;
char * major;
public:
public:
Student(char * aName, char* m);
Student(char * aName, char* m);
void Print(){
void Print(){
Print();//Print of Person
Print();//Print of Person
cout<<
cout<< “
Major:
Major: ”
<< major <<endl;
<< major <<endl;
The pointer must be used with care when
The pointer must be used with care when
working with overridden member
working with overridden member
functions
functions
We represent the classes involved in
We represent the classes involved in
inheritance relation in tree like hierarchy
inheritance relation in tree like hierarchy