There is a class TFigure which should refer to its descendants TRectangle and TTriangle for the variables ry1 , rx3 and txN , tyN (where N is a number from 1 to 3, defining a pair of points.) It is necessary from the class TFigure using the IsIntersect method to refer to the classes TTriangle and TRectangle for coordinates points for processing through the block conditions. Codes:
TFigure.cpp
#include "stdafx.h" #include "TFigure.h" #include <iomanip> using namespace std; TFigure::TFigure() { StepX = 0; StepY = 0; } TFigure::~TFigure() { } void TFigure::Move() { } void TFigure::IsIntersect() { //for (int iy = ry1; iy < ry3; iy++) // переменная ry1 И ry3 определена в классе TRectangle. Как дать знать классу TFigure про их существование и чему они равны? //{ //} } TRectangle.cpp
... TRectangle::TRectangle() { rx1 = 0; // x1,y1 x2,y2 ry1 = 0; // x3,y3 x4,y4 rx2 = 10; ry2 = 0; rx3 = 0; ry3 = 4; rx4 = 10; ry4 = 4; // rStepX = 0; // rStepY = 0; } TRectangle::~TRectangle() { } ...