000
03.10.2005, 22:09 Uhr
~BT111
Gast
|
my question is , is it possible to name a function with a class name like: Point GetUpperLeft() const { return itsUpperLeft; } I just dont understand that, is this word "point" ment to be the name of the class point or does it have another meaning in: Point GetUpperLeft() const { return itsUpperLeft; }
i ll be grateful to know the answere from somebody.
C++: |
// Beginn von rect.hpp #include <iostream>
class Point // nimmt X/Y-Koordinaten auf { // Kein Konstruktor, Standardkonstruktor verwenden public: void SetX(int x) { itsX = x; } void SetY(int y) { itsY = y; } int GetX()const { return itsX;} int GetY()const { return itsY;} private: int itsX; int itsY; }; // Ende der Klassendeklaration von Point
class Rectangle { public: 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); void SetLowerLeft(Point Location); void SetUpperRight(Point Location); void SetLowerRight(Point Location);
void SetTop(int top); void SetLeft (int left); void SetBottom (int bottom); void SetRight (int right);
int GetArea() const;
private: Point itsUpperLeft; Point itsUpperRight; Point itsLowerLeft; Point itsLowerRight; int itsTop; int itsLeft; int itsBottom; int itsRight; }; // Ende von Rect.hpp
|
mod edit: use code tags by yourself! Dieser Post wurde am 03.10.2005 um 22:12 Uhr von Pablo editiert. |