L
laniik
Hi. I have a base class
class base {
public:
static int x;
base() {cout<<x<<endl;}
virtual void hi();
};
int base::x=0;
//and a class that inherets it
class subbase : public base{
public:
void hi() {cout<<"hi"<<end;}
};
when i compile it on g++ i get several problems
1) undefined symbol
vtable for base
typeinfo for base
i think this has to do with the virtual functions... am i using them
incorrectly?
2) base::x is multiply defined
how can i get it so that the sub-classes dont try to redefine x?
Thanks!
Oliver
class base {
public:
static int x;
base() {cout<<x<<endl;}
virtual void hi();
};
int base::x=0;
//and a class that inherets it
class subbase : public base{
public:
void hi() {cout<<"hi"<<end;}
};
when i compile it on g++ i get several problems
1) undefined symbol
vtable for base
typeinfo for base
i think this has to do with the virtual functions... am i using them
incorrectly?
2) base::x is multiply defined
how can i get it so that the sub-classes dont try to redefine x?
Thanks!
Oliver