Blogger news

Followers

Thursday, September 26, 2013
#include<iostream.h>
 #include<conio.h>

 class student
 {
   protected:
     int rollno;
   public:
    void getroll()
    {
      cout<<"enter the roll no"<<endl;
      cin>>rollno;
    }
 };
 class marks:public student
 {
   protected:
     int marks;
  public:
     void getmarks()
     {
       cout<<"enter the marks"<<endl;
       cin>>marks;
     }
     void display()
     {
      getroll();
      cout<<"roll no:"<<rollno<<endl<<"marks:"<<marks;
     }
 };


 void main()
 {
   marks b;
   clrscr();
   b.getmarks();
   b.display();
   getch();
 }

Screenshot:


0 comments: