Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help with C++ visual studio program, I have 2 issues I\'d like to have he

ID: 3760863 • Letter: P

Question

Please help with C++ visual studio program, I have 2 issues I'd like to have help fixing. #1) error LNK2001: unresolved external symbol "public: virtual void __thiscall BasicShape::calcArea(void)" (?calcArea@BasicShape@@UAEXXZ) #2) error LNK1120: 1 unresolved externals. Below is the code I'm using. Thank you so much for any help you have to offer.

#include <iostream>

using namespace std;

class BasicShape{
private:
   double area;
public:
   double getArea(){
       return area;
   }
   void setArea(double a){
       area = a;
   }
   virtual void calcArea();
};

class Circle : public BasicShape{
private:
   double centerX;
   double centerY;
   double radius;
public:
   Circle(double x, double y, double r){
       centerX = x;
       centerY = y;
       radius = r;
       calcArea();
   }
   void calcArea(){
       setArea(3.14159*radius*radius);
   }
   double getCenterX(){
       return centerX;
   }
   double getCenterY(){
       return centerY;
   }
};

class Rectangle : public BasicShape{
private:
   double length;
   double width;
public:
   Rectangle(double l, double w){
       length = l;
       width = w;
   }
   void calcArea(){
       setArea(length*width);

   }
   double getLength(){
       return length;
   }
   double getWidth(){
       return width;
   }
};

int main(){
   BasicShape *bs_1 = new Rectangle(10.0, 6.0);
   bs_1->calcArea();
   cout << bs_1->getArea() << endl;

   BasicShape *bs_2 = new Circle(10.0, 6.0, 8.0);
   bs_2->calcArea();
   cout << bs_2->getArea() << endl;
   return 0;
}

Explanation / Answer

Change is specified in bold.

class BasicShape{
private:
double area;
public:
double getArea(){
return area;
}
void setArea(double a){
area = a;
}
virtual void calcArea(){
  
   }

};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote