Advertisement

An Inheritance Question

Started by July 30, 2000 10:56 AM
0 comments, last by n0t_l33t 24 years, 4 months ago
Suppose I have a class defined as:
    
class Verticies {
public:
	Verticies();
	void AddVertex(float x, float y, int pos); //adds a vertex to the list

	void DeleteVertex(int VertexNum);  //Deletes a vertex with a give point number

	void PrintVerticies();  //print all verticie info to the screen

	void XYRotate(float angle); //angle in rad, used by rotate, can be used alone to roate object around origin
	void Rotate(int RotatePoint, float angle); //rotates around a given point, angle in rad
	void ScaleVertex(float ScaleFactor);  //Sent as a percentage, e.g. 102%
	void MakeCircle(float x, float y, float d); //makes a circle centered @ x,y w/ diameter d
	int GetNumVerticies();  //return the number of verticies currently in list

	void GLRenderScene(void);    //sets up glVertex information for gl rendering

	void DeleteAll(void); //clears the linked list.

	~Verticies();  //the destructor

private:
	struct Node {
		float x, y; //position of point in rectangular coordinates.

		int PointNum;
		Node* Next;
		Node* Prev;
	};
	Node* Front,* Back;  //keep track of the front and back of the list

	int NumVerticies;//tells how many points there are total.


	//private functions for addvertex command

	void AddVertexPos(float x, float y, int pos);  //Adds Vertex @ given position

	void AddVertexBack(float x, float y); //Tacks the new point to the end of the list

};
    
how could i write a class that would extend that into making a 2nd object behind the 1st for a 3d effect, like this: ------- /| /| ------- / |/ |/ -------- where the one in front is the original box, and the box behind is the new one from the new class any ideas would be helpful
Make another class which derives from vertices.

class shadow: public vertices {

//stuff etc.

};

Of course not forgetting to make all you private stuff protected.

->Lucas
- Lucas::~Lucas();

This topic is closed to new replies.

Advertisement