class 'A' is no direct base of class 'B'

I have something like this

class A{//interface}; //implementation
class B{//interface includes a member of type 'A'}; //in implementation of Class 'B' constructor I write

B::B():A(5){} //class 'A' had a constructor of prototype A(int);

now what compiler tells me is

[Error] type 'A' is not a direct base of 'B'
If B has a member of type A, then the constructor needs to be initializing that member. B::B() : member_name(5) { }
Oh! what the socket, I'm too stupid, I was using 'A' the class name in initializer instead of 'x' which was the original member of type 'A' i.e. A x;

Thankyou very much Cubbi
Topic archived. No new replies allowed.