0

I've got a program which works but when I try to implement a destructor in the base call and make it a virtual pure function it doesnt want to work with the rest of the system ...


circle.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall Shape::~Shape(void)" (??1Shape@@UAE@XZ)
rectangle.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall Shape::~Shape(void)" (??1Shape@@UAE@XZ)
Debug/main.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Any ideas?

2
Contributors
4
Replies
5
Views
12 Years
Discussion Span
Last Post by Acidburn
0

heres the base class:

class Shape
  {
    public:
       Shape(int,int) ;
       Shape () ;
      virtual  ~Shape() =0;
      virtual void print()const = 0;
      virtual double calArea() = 0;
      	  
    protected:
     int  centreX,centreY;
   };

#endif

now from that you can see the the destructor is virtual and is pure meaning no function body needs defining

but when I write an implemenation is the other class's it doesnt like it!

I have included a zip of all the files .......

0

Rather than download and unzip your attachment, then screw around with your code to get it running on my implementation, I'll make you try this first:

virtual  ~Shape() =0 {}
0

i works doing that, can you explain why you need '{}' for destrutors and not for the others?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.