c++7 - 1 x C++B * 2 C++ * + * * & /...

Info iconThis preview shows pages 1–20. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 x C++B * 2 C++ * + * * & / & 3 C++ * * + p * + p * & +B * 4 C++ ` & & 5 C++ + & & 6 C++ + + + 7 C++ * + + + + 8 C++ * & + * + p * + p + 9 C++ * class L &O O { B } 10 C++ + & + + + & + & * + + + 11 C++ + (public) && public protected h O r& h O && & h O private & h O A & o&& O r& LC public protected &&&&&&&& && private && & A & o&&& & public & 12 C++ + 7-1 &O * class Point // Point {public: // &O r void InitP(float xx=0, float yy=0) {X=xx;Y=yy;} void Move(float xOff, float yOff) {X+=xOff;Y+=yOff;} float GetX() {return X;} float GetY() {return Y;} private: // &O r float X,Y; }; class Rectangle: public Point // & &O { public: // & &O r void InitR(float x, float y, float w, float h) { InitP (x,y);W=w;H=h;} // float GetH() {return H;} float GetW() {return W;} private: // & &O r float W,H; }; 13 #include<iostream> #include<cmath> using namecpace std; int main() { Rectangle rect; rect.InitR(2,3,20,10); // & A o&&&&&&&& rect. Move (3,2); cout<<rect. GetX ()<<',' <<rect. GetY ()<<',' <<rect.GetH()<<',' <<rect.GetW()<<endl; return 0; } 14 15 C++ 16 C++ + (private) && public protected && & private & A o &&& & private & Lh r A & o&&2 h r& LC public protected &&&&&&&& && & private && LC r&& A / o& p & 17 C++ + 7-2 LH & * class Rectangle: private Point // LH & {public: // LH & r void InitR(float x, float y, float w, float h) { InitP(x,y); W=w;H=h;} // LH & r void Move(float xOff, float yOff) { Point::Move (xOff,yOff);} float GetX() {return Point::GetX() ;} float GetY() {return Point::GetY() ;} float GetH() {return H;} float GetW() {return W;} private: // LH & r float W,H; }; #include<iostream> #include<cmath> using namecpace std; int main() { // & A o&&& &&&& && Rectangle rect; rect. InitR (2,3,20,10); rect. Move (3,2); cout<<rect. GetX ()<<',' <<rect. GetY ()<<',' <<rect. GetH ()<<','<<rect. GetW ()<<endl; return 0; } 18 19 C++ + (protected) && public protected && & protected & A o& &&& & & private & L < r...
View Full Document

Page1 / 68

c++7 - 1 x C++B * 2 C++ * + * * & /...

This preview shows document pages 1 - 20. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online