what is single inheritance?
Answers were Sorted based on User's Feedback
Answer / dev
When a derived class has only one base class its called a
single inheritance
Is This Answer Correct ? | 106 Yes | 7 No |
Answer / jasbir singh
when a single class is being inherited by a class, it is
called single or simple inheritance.
example:
class a
{
public:
int x,y;
};
class b: public a //// example of simple inhieritence
{
public:
int z;
}
Is This Answer Correct ? | 91 Yes | 19 No |
Answer / ranjit kumar nayak
inheritance is single bcoz it sharing the property between
two classes.one is called parent another is child.
Is This Answer Correct ? | 75 Yes | 21 No |
Answer / karthikse09
one class derived from base class is called inheritance
Is This Answer Correct ? | 51 Yes | 10 No |
Answer / anjana
SINGLE INHERITANCE:
ONE BASE CLASS HAVING ONE DERIVED CLASS MEANS THAT IS CALLED SINGLE INHERITANCE.
EXAMPLE:
[A]------->BASE CLASS
|
V
[B]------->DERIVED CLASS
Is This Answer Correct ? | 39 Yes | 4 No |
Answer / sathish
Inheritance : The Base Class information passed onto
derived class.
Single Inheritance : The Derived class having only one Base
class is called single Inheritance.
Multiple Inheritance : The Derived class having more than
one base class is called Multiple Inheritance.
Is This Answer Correct ? | 33 Yes | 1 No |
Answer / mosin
only one base class with derived to only one derived class
Is This Answer Correct ? | 33 Yes | 11 No |
Answer / tanu agarwal
single inheritance is defined as the one in which derived
class inherits only one base class .
Is This Answer Correct ? | 21 Yes | 5 No |
Answer / kanna
Only One parent per Derived class.it mean one base class having one derived class is single inheritance.
The derived classes may have a number of direct base classes,is multiple inheritance.
Is This Answer Correct ? | 14 Yes | 3 No |
Answer / 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 |
What is overloading in oops?
Can we have inheritance without polymorphism?
Petrol pump mgt. system: To design a program that display an interface for the sale of the Petrol and then make the entries at the backend in the database.
OOP'S advantages of inheritance include:
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
how do u initialize the constant variables
How long to learn object oriented programming?
In what situation factory design patterns,DAO design patterns,singleton design patterns should be applied.?
Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.
What is destructor give example?
what is the use of classes in c++;
What is interface? When and where is it used?