Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is single inheritance?

Answer Posted / sabari

Deriving only one class from base class is called single inheritance.
For example:
#include<iostream.h>
#include<conio.h>
class student
{
public:
int rno;
char na[30];
void input();
};
void student::input()
{
cout<<"enter the student name";
cin>>na;
cout<<"enter the register no:";
cin>>rno;
}
class mark:public student //derivation
{
int m1,m2,m3;
float t,av;
public:
void display()
{
cout<<"Enter m1,m2,m3 values\n"
cin>>m1>>m2>>m3;
t=m1+m2+m3;
av=t/3;
cout<<endl<<"name="<<na;
cout<<endl<<"Register number="<<rno;
cout<<endl<<"total="<<t;
cout<<endl<<"average="<<av;
}
};
void main()
{
clrscr();
mark ob;
ob.input();
ob.display();
getch();
}

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is for loop and its syntax?

1033


Is html an oop?

999


How do you achieve polymorphism?

1036


which feature are not hold visual basic of oop?

2147


What is class and object with example?

1057


Why is there no multiple inheritance?

952


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1569


What is polymorphism oop?

1006


what is different between oops and c++

2455


Why do we need polymorphism in c#?

1094


when to use 'mutable' keyword and when to use 'const cast' in c++

2109


write string class as your own class in java without using any built-in function

2442


c++ program to swap the objects of two different classes

2357


What does sksksk mean in text slang?

2053


How do you use inheritance in unity?

1024