In the OOP the single inheritance concept is to access the parent/super class properties into the derived class.
Coding :
#include<iostream.h>
#include<conio.h>
#include<conio.h>
class test {
char name[20], add[20];
int roll;
public:void getdata(){
cout<<"Enter your name, address and roll number";
cin.getline(name,20);
cin.getline(add,20);
cin>>roll; }
void putdata() {
cout<<"Your name address and roll no. is"<<name<<add<<roll;
};
class test1:public test {
int phone,fees;
public: void get() {
test::getdata(); {
cout<<"Enter your phone number & fees";
cin>>phone>>fees;}}
void put(){
test::putdata();{
cout<<"Your phone number and fees are"<<phone<<fees;}}
void main(){
clrscr();
test1 t ;
t.get();
t.put();
getch(); }
struct A {}; // base class struct B : A {} // derived class (single inheritance).
struct base1 { // ... }; struct base2 { // ... }; struct derived1 : public base1 // single inheritance { // ... }; struct derived2 : public base1, public base2 // multiple inheritance { // ... };
Its limited only by available memory.
Yes.
C is not object-oriented -- you can't even use single inheritance let alone multiple inheritance.
C++ allows multiple inheritance while Java does not. In my opinion, multiple inheritance is not useful because it can get very confusing very quick. For polymorphism, C++ does early binding by default, while Java does late binding by default. Late binding is more useful than early binding.
Yes, you can program games with C++.
Multiple inheritance occurs when a class is derived directly from two or more base classes. class b1 {}; class b2 {}; class d: public b1, public b2 {}; // multiple inheritance class
struct employee { }; struct supervisor : employee { // single inheritance -- a supervisor inherits all the public and protected properties of an employee. }; struct manager : supervisor { // multilevel inheritance -- a manager inherits all the public and protected properties of a supervisor (and therefore an employee). };
Exit the program and relaunch it.
It cannot. Inheritance is a compile-time operation. Constructors are invoked at runtime at the point of instantiation.
d a tool for analysing c plus plus program