View Single Post
Old May 26th, 2006, 7:49 AM   #5
Tegelane
Newbie
 
Join Date: May 2006
Location: Estonia
Posts: 8
Rep Power: 0 Tegelane is on a distinguished road
#include <iostream>

using namespace std;

class Base
{
public:
  Base() {};
  ~Base() {};
  virtual void stuff1();
  virtual void stuff2();
};

void Base::stuff1()
{
 stuff2();
}

class Derived : public Base
{
public:
  Derived() {};
  ~Derived() {};
  void stuff2();
};

void Derived::stuff2()
{
  cout<<"asdasd"<<endl;
  return;
}

int main()
{
Derived d;
d.stuff1();
return 0;
}

the code should be something like this. i think..
and compiling this gives me a linker error about undefined Base::stuff2()

/tmp/ccBAAYa4.o.rodata._ZTV4Base[vtable for Base]+0x18): undefined reference to `Base::stuff2()'

if i implement Base::stuff2() witch does nothing, it works as needed
Tegelane is offline   Reply With Quote