#include <iostream> using namespace std; //parent class Coordinate{ private: double value1, value2; public: //constructor Coordinate(double, double); double get_distance(Coordinate); virtual double convert(Coordinate) = 0; }; //child 1 class Polar_Coordinate: public Coordinate{ public: Polar_Coordinate(double x, double theta); }; //child 2 class Cartesian_Coordinate: public Coordinate{ public: Cartesian_Coordinate(double x, double y); }; void main(){ Polar_Coordinate p;// Why doesn't this line work? //or why doesn't this line work //Coordinate c; }

I dont undrstand why Polar_Coordinate p; doesn't work or Coordinate c;

i get this error:

error C2512: 'Polar_Coordinate' : no appropriate default constructor available

error C2259: 'Polar_Coordinate' : cannot instantiate abstract class

My program is to convert polar to certesian and vice versa. This is the code that my professor gave to me to use. Right now Im just trying to get used to using inheritance and polymorphism.

Thank you!