Hello everybody, i am beginner and im studing the inheritance, virtual fuction. and Im practising a console app about calculate Figure (Phere)
when Run this code, it issue any error as:
LNK2001 unresolved external symbol "public: virtual int __thiscall Figure::Volume(void)" (?Volume@Figure@@UAEHXZ)
LNK2001 unresolved external symbol "public: virtual int __thiscall Figure::Area(void)" (?Area@Figure@@UAEHXZ)
Help me to fix this code.
class Figure
{
public:
virtual int Area();// = 0;// pure virtual
virtual int Volume();// pure virtual
protected:
int m_radius;
int m_height;
int m_area;
int m_volume;
};
//////////////////////////////////////////////////////////////////////////
class Circle : public Figure
{
public:
Circle() {};
Circle(int radius);
int Area() override;
protected:
Four problems:
1.) You did not define Figure::Area and Figure::Volume;
2.) You did not define Sphere::Area
3.) You did not make Circle methods virtual (not necessarily needed, since it is virtual by default, but still good to make them explicit)
4.) You did not use code tags: http://www.cplusplus.com/articles/jEywvCM9/
thank you so muchh.
I have fixed as you guided.
and problem 4, sorry for the inconvenience, i dont know why, when i take all of my code and then press "<>" button then it issue error website... i trying to several times but it same.
so I leave it.