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

Pure Virtual Function And Abstract Class In C++ | Pure Virtual Function And Abstract Class In C++ In Hindi

 

Pure Virtual Function And Abstract Class In C++

Sometimes implementation of all function cannot be provided in a base class because we don’t know the implementation.

A pure virtual function (or abstract function) in C++ is a virtual function for which we don’t have implementation, we only declare it. A pure virtual function is declared by assigning 0 in declaration.

image of Pure Virtual Function And Abstract Class In C++

Fig: Pure Virtual Function And Abstract Class In C++

Syntax:

class     base class

{

----

------

public:

virtual return type functionname(argument)=0;

};


Program:

#include<iostream.h>

#include<conio.h>

Class BCA

{

public:

virtual void get()=0;

};

class MCA: public BCA

{

public:

 int a;

void get()

{

cout<<”input one no”;

cin>>a;

cout<<a;

}

};

void main()

{

MCA a2;

a2.get();

getch();

}


Output:

Input one no 76

76

No comments:

Post a Comment