0 / 0 / 0
Регистрация: 26.11.2010
Сообщений: 8
|
|
1 | |
изучение Классов26.11.2010, 16:21. Показов 749. Ответов 0
Метки нет Все метки)
(
Добавлено через 11 минут
[QUOTE=alexandrk8;1144396]//Header Files #include <iostream> class Point { public: void SetX(int x) {itsX=x;} void SetY(int y) {itsY=y;} int GetX() const {return itsX;} int GetY() {return itsY;} private: int itsX; int itsY; }; class Rectangle { Rectangle(int top,int left,int bottom,int right); ~Rectangle(){} int GetTop() const {return itsTop;} int GetLeft() const {return itsLeft;} int GetBottom() const {return itsBottom;} int GetRight() const {return itsRight;} Point GetUpperLeft() const {return itsUpperLeft;} Point GetLowerLeft() const {return itsLowerLeft;} Point GetUpperRight()const {return itsUpperRight;} Point GetLowerRight()const {return itsLowerRight;} void SetUpperLeft (Point Location) {itsUpperLeft=Location;} void SetLowerLeft (Point Location) {itdLowerLeft=Location;} void SetUpperRight (Point Location) {itsUpperRight=Location;} void SetLowerRight (Point Location) {itsLowerRight=Location;} void SetTop (int top) {itsTop=top;} void SetLeft(int left) {itsLeft=left;} void SetBottom (int bottom) {itsBottom=bottom;} void SetRight (int right) {itsRight = right;} int GetArea() const; private: Point itsUpperLeft; Point itsUpperRight; Point itsLowerLeft; Point itsLowerRight; int itsTop; int itsLeft; int itsBottom; int itsRight; }; // Cpp #include "hrectangle.h" Rectangle::Rectangle (int top ,int left, int bottom, int right) { itsTop = top; itsLeft = left; itsBottom = bottom; istRight = right; itsUpperLeft.SetX(left); itsUpperLeft.SetY(top); itsUpeerRight.SetX(right); itsUpeerRight.SetY(top); itsLowerLeft.SetX(left); itsLowerLeft.Sety(bottom); itsLowerRight.SetX(right); itsLowerRight.SetY(bottom); } int Rectangle::GetArea() const { int Width=itsRight-itsLeft; int Height=itsTop=itsBottom; return (Width * Height); } int main() { Rectangle MyRectangle (100,20,50,80); int Area= MyRectangle.GetArea(); std::cout<<"Area: " <<Area<<endl; std::cout<<"Upper Left X Coordinate: "; std::cout<<MyRectangle.GetUpperLeft().GetX(); return 0; } : error C2059: syntax error : 'PCH creation point' : error C2334: unexpected token(s) preceding '{'; skipping apparent function body : error C2059: syntax error : 'PCH creation point' : error C2334: unexpected token(s) preceding '{'; skipping apparent function body : error C2059: syntax error : 'PCH creation point' : error C2334: unexpected token(s) preceding '{'; skipping apparent function body : fatal error C1004: unexpected end of file found
__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь
0
|
|
26.11.2010, 16:21 | |
Ответы с готовыми решениями:
0
Изучение принципов объектно-ориентированного программирования. Инкапсуляция. Конструкторы и деструкторы классов. Создание экземпляров класса Создание java классов в коде С++ и вызов Java методов и классов из C++ Разработать иерархию классов, демонстрирующее работу с коллекцией объектов разных классов На основе указанных классов создать набор классов с использованием множественного наследования |
26.11.2010, 16:21 | |
Помогаю со студенческими работами здесь
1
Автоматическая генерация классов С ++ с UML диаграмм классов. Наследование в с++. Абстрактные классы. WhiteStarUML Вынести методы из классов Panel и PictureBox (явная реализация методов базовых абстрактных классов)
Искать еще темы с ответами Или воспользуйтесь поиском по форуму: |