I have this code -
Code:
class A
{
public:
A(int a)
{
cout<<"Base class A"<<a<<endl;
}
}
class B:public class A
{
public:
B(int b,int a):A(int a)
{
cout<<"Derived class B"<<b<<endl;
}
}
class C:public class A
{
public:
C(int c,int a):A(int a)
{
cout<<"Derived class C"<<c<<endl;
}
}
class D:public class C,public class B
{
public:
D(int d,int c,int b):C(int c,int a),B(int b,int a)
{
}
}
main()
{
D d(1,2,3);
}
now here when the objects d(1,2,3) is created. then constructor of D will be called. in that as the class c is initalized first so it will get called but how it gets the value of int a. i am not the getting the flow of the programme. Please help me to understand.
Thanks