Уважаемые программисты, здравствуйте!
Пишу несложную программу. Знаю, где ошибка:
| Код | Point *Triangle::GetPointA(){ return this -> A; }
Point *Triangle::GetPointB(){ return this -> B; }
Point *Triangle::GetPointC(){ return this -> C; }
|
Но исправить не могу. Помогите, пожалуйста. Среда разработки Borland C++ 3.1. Трудно без дебаггера. =( Весь код:
| Код | #include <stdio.h> #include <iostream.h>
class Point{ private: int x, y; public: Point (){}; Point (int x, int y); ~Point (); int GetX(); int GetY(); };
Point::Point (int x, int y){ this -> x = x; this -> y = y; }
Point::~Point(){}
int Point::GetX(){ return this -> x; }
int Point::GetY(){ return this -> y; }
class Triangle{ private: Point *A; Point *B; Point *C; public: Triangle (){}; Triangle (Point *A, Point *B, Point *C); ~Triangle (); void Info(); Point *GetPointA(); Point *GetPointB(); Point *GetPointC(); };
Triangle::Triangle (Point *A, Point *B, Point *C){ this -> A = A; this -> B = B; this -> C = C; }
Triangle::~Triangle(){}
void Triangle::Info (){ printf ("A: x = %d; y = %d\nB: x = %d; y = %d\nC: x = %d; y = %d\n", this -> A -> GetX(), this -> A -> GetY(), this -> B -> GetX(), this -> B -> GetY(), this -> C -> GetX(), this -> C -> GetY()); }
Point *Triangle::GetPointA(){ return this -> A; }
Point *Triangle::GetPointB(){ return this -> B; }
Point *Triangle::GetPointC(){ return this -> C; }
class Petal{ private: Triangle *TrL; public: Petal (){}; Petal (Triangle *TrL); ~Petal (); void Info(); };
Petal::Petal (Triangle *TrL){ this -> TrL = TrL; }
Petal::~Petal (){}
void Petal::Info (){ printf ("Triangle L:\n A: x = %d; y = %d\n", this -> TrL -> GetPointA() -> GetX(), this -> TrL -> GetPointA() -> GetY()); }
void main (){ Point *A, *B, *C; Triangle *Tr1; Petal Fl; A = new Point (1,1); B = new Point (2,3); C = new Point (3,22); Tr1 = new Triangle (A, B, C); Petal F1 (Tr1); Fl.Info(); }
|
|