S
silverburgh.meryl
How come I an not use class initialization to initalize inherited
attributes?
i have this code:
B::B(A& a) {
x = a.x;
y = a.y;
}
class A {
public:
int x;
int y;
};
class B: public A{
public:
B(A& a);
};
and I get this compile error:
B.cpp:34: error: class 'B' does not have any field named 'x'
Bc.pp:35: error: class 'B' does not have any field named 'y'
can someone please tell me why?
Thank you.
attributes?
i have this code:
B::B(A& a) {
x = a.x;
y = a.y;
}
class A {
public:
int x;
int y;
};
class B: public A{
public:
B(A& a);
};
and I get this compile error:
B.cpp:34: error: class 'B' does not have any field named 'x'
Bc.pp:35: error: class 'B' does not have any field named 'y'
can someone please tell me why?
Thank you.