There is non-pointer (body) nested class in outer class.I need to call its constructor from outer class constructor after some calculations.How to do?
class nested
{
int value;
nested(int x) {value=x;};
nested() {value=0;};
};
class outer:
{
nested n;
nested *pn;
outer(int x);
};
outer::outer(int x1)
{
x = x1;
y = x + 1 *x*x;//some long calculations needed for nested
pn = new nested(y); //this is trivial
n = nested(y); //??? how to initialize non-pointer class?????
}