One of my fellow programer came into such a problem: how to initialize a class with two private variables contained in another class' constructor.
Why initialization in this way can get the job down?
Thanks in advance.

#include <iostream.h>
class B
{
public:
B(){};
B(int i, int j);
void printb();
private:
int a , b;
};

B::B(int i,int j)
{
a=i;
b=j;
}

void B:rintb()
{
cout<<"a="<<a<<",b="<<b<<endl;
}





class A
{
publcic:
A(){};
A(int i, int j);
void printa();
private:
B c;
};



A::A(int i,int j):c(i,j) // the special usage of initialization, private value of i and j can be initializated
{
}

void A:rinta()
{
c.printb();
}


void main()
{
A m(7,9);
m.printa();
}


VC++ developer