Hello,

I have been working on this code for a week. I have a point class I created and got everything working. Then I had to create a circle class from the point class. Originally I used an inheritance relationship, then I rewrote the code for a composition relationship. I got everything working in the circle class. Then, moved on to a cylinder class that has a composition relationship to the circle class. I finally have all the functions working in this class, with the exception of the cylinder calc functions that use a circle calc function. I think it is because I need to overload the '+' and '*' to perform their operation on the circle class function. So, I went looking in my textbook and the other four books I purchased for additional reference. And, none of them explain the operator overloading sufficiently to apply it to my need.

If anyone can help me by explaining what the body of my operator overload functions should look like I would appreciate it.

Here is my cylinderType class definition in my header file:
Code:
#ifndef H_CYLINDER
#define H_CYLINDER

#include "circleClass.h"

class cylinderType: public circleType
{
	public:
		cylinderType();
		cylinderType(int xCoord, int yCoord, int radius, int height);

		void setHeight(int height);
		void setCylinder(int xCoord, int yCoord, int radius, int height);
		void setRadius(int radius);
		void setCircle(int xCoord, int yCoord, int radius);
		void setPoint(int xCoord, int yCoord);
		void getHeight(int & height);
		void getCylinder(int & xCoord, int & yCoord, int & radius, int & height);
		void getRadius(int & radius);
		void getCircle(int & xCoord, int & yCoord, int & radius);
		void getPoint(int & xCoord, int & yCoord);

		cylinderType operator+(const cylinderType &) const;
		cylinderType operator*(const cylinderType &) const;

		double calcLateralSurfArea();
		double calcVolume();
		double calcArea();
		double calcCircum();
		
		void whereAmI();
		void printLateralSurfArea();
		void printVolume();
		void printHeight() const;
		void printCylinder() const;
		void printArea();
		void printCircum();
		void printRadius() const;
		void printCircle() const;
		void printPoint() const;
		
	private:
		pointType point;
		circleType circle;
		int h;
};

#endif
And, here is part of the cpp implementation file. I eliminated some of the functions to save space and they weren't part of the problem. My code does compile and work excluding the calc functions:
Code:
#include "cylinderClass.h"

cylinderType cylinderType::operator +(const cylinderType & right) const
{
	cylinderType temp;
	temp = ;
}

cylinderType cylinderType::operator *(const cylinderType & right) const
{
	cylinderType temp;
}

double cylinderType::calcLateralSurfArea()
{
	return (circle.calcCircum() * h);
}

double cylinderType::calcTotalSurfArea()
{
	int radius;
	return (circle.calcCircum() * (circle.getRadius(radius) + h));
}

double cylinderType::calcArea()
{
	return (circle.calcArea());
}

double cylinderType::calcVolume()
{
	return (circle.calcArea() * h);
}

void cylinderType::printLateralSurfArea()
{
	cout << "The Lateral Surface Area of a cylinder with ";
	circle.printRadius(); 
	cout <<	" and a height of " << h << " is ";
	calcLateralSurfArea();
	cout << endl;
}

void cylinderType::printTotalSurfArea()
{
	cout << "The Total Surface Area of a cylinder with a radius of ";
	circle.printRadius();
	cout << " and a height of " << h << " is "; 
	calcTotalSurfArea();
	cout << endl;
}

void cylinderType::printVolume()
{
	cout << "The Volume of a cylinder with ";
	circle.printRadius();
	cout << " and a height of " << h << " is ";
	calcVolume();
	cout << endl;
}
I cannot figure out the operator overload function definition for this application from the reference books I have. They all use the private variables witin the class (private: int a, b; then the function definition uses: "temp.a = a + right.a; temp.b = b + right.b; return temp;" or something similar) I can't figure out how to apply that to my situation.

Thanks.