Q:

c++ Simple code with classes

I'm writing a cpp program and i ran into a problem. It looks "easy" but still cant find out how to get rid of it.
Here's a simplified version of the problem:
class a
{
public:
    int number;
    a();
    a(int x);
    void set_num(int n);
};
a::a()
{

}

a::a(int x)
{
    number = x;
}
void a::set_num(int n)
{
    number = n;
}

class b
{
public:
    a abcdef();

    b();
    b(int x);
};

b::b(int x)
{
    abcdef.set_num(x);
}

I want to use "class a"-s copy in "class b" and i want to give it a value with the "set_num" function in "b"-s constructor after i created it with its default constructor ("a abcdef();")
But when i run the code it says:
error: '((b*)this)->b::abcdef' does not have class type.
Any idea, how to solve this problem?
Thanks for your help.

A:

When you write:  
    a abcdef();  // oops, do you really want this ? 

it means that you have a member function in you b class, that takes no argument and return an a. 
From your explanation I understand that you certainly wanted an a object as member:  
    a abcdef;  // this is a member variable that you can set with setnum. 

