by Dinesh Thakur Category: Classes in C++

 

#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;
              s1.insert();
              s1.show();
              getch();
       }

Abstract class and Pure virtual function

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content







Popular Article