derive 1 , derive 2, derive 3;
derive 2 Inherit from derive 1;
derive 3 also Inherit from derive 1 and derive 2;
derive 3 It includes a constructor and a display function that calls the display functions of the parents.
I did all at above
but ;
I do not know how can I Inherit from derive 1 and derive 2?
if derived 3 inherits fom derived 2 it will also inherits fom derived 1 , since derived 2 inherits from derived 1. the moment this is not true is if derived 2 private inherits from derived 1.
this is my code,
can you show me in action please
I did tray it put, it is take an error for me
----------------------------------------------------------------------------------------
#include<iostream>
#include<string>
using namespace std;
class derive1
{
public:
int initial;
int current ;
int profit;
int percent;
public:
derive1(){initial = 0, current = 0 , profit = 0, percent = 0;}
derive1(int i , int c, int p , int pe)
{initial = i;
current = c;
profit = p;
percent = pe;
}
};
class derive2 : public derive1
{
public:
string street;
int square;
public:
derive2 (){street = ""; square = 0;}
derive2 ( int i , int c, int p , int pe ,string s,int sq):derive1(i ,c , p , pe)
{street = s;
square = sq;
}