Need help with inheritence (not compiling)

I'm trying to do shape inheritance for class, and because it's fairly long (to me at least), I'm looking for assistance to find out why it won't compile.
I've broken the code down to one base and one subclass and tried to pick parts to remove and such, but I can't seem to figure out what's wrong.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef SHAPE_H
#define SHAPE_H
#include <string>
using namespace std;

class Shape 
{
public:
	Shape(string=0,string=0);
	void Draw();
	double CalArea(double);
	void setname(string);
	void setcolor(string);
	string getname();
	string getcolor();
private:
	string name;
	string color;
	static int count;
};


#endif
#include <string>
#include "Shape.h"
#include <iostream>
using namespace std;

int Shape::count=0;
Shape::Shape(string n, string c) {
	name = n;
	color = c;
	count++;
}

void Shape::Draw(){
	cout << color << name << CalArea;
}

double Shape::CalArea(double r){
	double area=3.14*r*r;
	return area;
}

void Shape::setname(string s)
{name = s;}
void Shape::setcolor(string s)
{color = s;}
string Shape::getname()
{return name;}
string Shape::getcolor()
{return color;}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef Circle_H
#define Circle_H
#include "Shape.h"
#include <string>
using namespace std;

class Circle: public Shape
{
public:
	Circle (string=0, string=0,double=0);
	double CalCircumference();
	void setradius(double);
	double getradius();
private:
	double radius;
};

#endif Circle_H
#include "Circle.h"
#include <string>
using namespace std;

Circle::Circle(string name, string color,double u){
	Shape(name,color);
	double radius=u;
};

void Circle::setradius(double a)
{radius = a;}

double Circle::getradius()
{return radius;}

double Circle::CalCircumference()
{double Cir=2*3.14*radius;
return Cir;}


I don't think I need to include the main function (yet), because I'm pretty sure that the problem lies somewhere within the Shape.h/.cpp.
Last edited on
Topic archived. No new replies allowed.