I have class A
with method display()
. I create a struct B
with a static variable of type object A
:
class A{
public :
void display()
{
cout << "in A " << endl;
}
};
typedef struct B{
static A a;
} bb;
//B::a.display();
int main() {
bb b;
bb::a.display();
return 0;
}
Now I get an error when try to access a
.
How can I define a static object in this case?