R
r
I compile this on a Max OSX with
GCC version 1151, based on gcc version 3.1 20020420
g++ foo.cpp
ld: Undefined symbols: <-- ERROR
vtable for Foo
Any idea why?
-r
**************** contents of foo.cpp **********
class Foo {
protected:
void setit(int);
public:
virtual void bar(); // only a subclass implements
};
class Bird : public Foo {
public:
void bar();
};
// ################
int a;
void Foo::setit(int i) {
a = i;
}
void Bird::bar() {
Foo::setit(8);
}
int main(int argc, char **argv) {
Bird *b = new Bird();
b->bar();
}
// end
GCC version 1151, based on gcc version 3.1 20020420
g++ foo.cpp
ld: Undefined symbols: <-- ERROR
vtable for Foo
Any idea why?
-r
**************** contents of foo.cpp **********
class Foo {
protected:
void setit(int);
public:
virtual void bar(); // only a subclass implements
};
class Bird : public Foo {
public:
void bar();
};
// ################
int a;
void Foo::setit(int i) {
a = i;
}
void Bird::bar() {
Foo::setit(8);
}
int main(int argc, char **argv) {
Bird *b = new Bird();
b->bar();
}
// end