Explain about Abstract Classes in C++

Estudies4you

3.2.3. Abstract Classes

Q21. Write about Abstract Classes.
Answer:
Abstract Classes
Abstract classes are the classes that contain only function declaration, but not its definition. That is, it provides just the skeleton of the class hiding the implementation details. These classes are extendable and can even contain virtual functions, which help the programmer to debug the bugs.
Abstract classes are defined in'a header file called abstract.h.

Example
#include <iostream.h>
#include <conio.h>
const int max = 80;
class first
{
protected:
char name[max];
char cls[max];
public:
virtual void insert()=0;
virtual void show()=0;
}
class second : public first
{
protected:
int fees;
public:
void insert()
{
cout<<“Name”;
cin>>name;
cout<<“Class”;
cin>>cls;
cout<<“Fees”;
cin>>fees;
}
void show()
{
cout<<“\nName:”<<name<<“\n”;
cout<<“Class:”<<cls<<“\n”;
cout<<“Fees:”<<fees<<"\n”’;
}
};
void main()
{
clrscr();
second s1;
sl.insert();
sl.show();
getch();
}

Output
Write about Abstract Classes in c++,Explain about Abstract Classes in C++,Abstract Classes in c++,use of Abstract Classes in c++,examples of Abstract Classes in c++,programs for Abstract Classes in c++,estudies4you,c++ lecture notes jntuh,c++ notes jntuh,c++ study material jntuh,oops using c++ lecture notes,

To Top