S
Scott
Hello,
I am writing a C++ class, as follows:
class A
{
...
private:
int i;
B b;
}
where B is another class:
class B
{
...
private:
int j;
}
Now, my constructor for class A is:
A::A(int x) : i( x ) {
...
}
And the constructor for B is:
B::B(int y) : j( y ) {
...
}
So, my question is - how do I initialize b with variable i from within A's
constructor? I hope this makes sense, and thanks for any assistance.
Best,
Scott
I am writing a C++ class, as follows:
class A
{
...
private:
int i;
B b;
}
where B is another class:
class B
{
...
private:
int j;
}
Now, my constructor for class A is:
A::A(int x) : i( x ) {
...
}
And the constructor for B is:
B::B(int y) : j( y ) {
...
}
So, my question is - how do I initialize b with variable i from within A's
constructor? I hope this makes sense, and thanks for any assistance.
Best,
Scott