TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Monday 24 August 2020

Function Overriding In C++ | Explain Function Overriding In C++ | Program Of Function Overriding In C++| Function Overriding In C++ In Hindi

 

Function Overriding In C++

Function overriding is a feature that allows us to have a same function in child class which is already present in the parent class. A child class inherits the data members and member functions of parent class, but when you want to override a functionality in the child class then you can use function overriding.

image of Function Overriding In C++
Fig: Function Overriding In C++

Program:

#include<iostream.h>

#include<conio.h>

void main()

{

class BaseClass()

{

public:

void disp()

{

Cout<<”function of parent class”;

}

};

class  DerivedClass: public BaseClass

{

public:

void disp()

{

cout<<”function of child class”;

}

};

void main()

{

 DerivedClass obj=DerivedClass();

obj.disp();

getch();

}

 

Output:

Function of child class.

 

No comments:

Post a Comment