Leftwindowrollup voidrollupconst voidrolldownconst

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: 清清清清清清清清清清清清清清清清清清清清清清“清清”清清清清清清 清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清 清清清清清清清清清清清清清 清清清清清清清清 CIMS 清清 清清清清清清清清 #ifndef USEFUL_H #define USEFUL_H 改改改改改改 class X { exampleuseful int i; public: X() { i = 0; } void set(int ii) { i = ii; } int read() const { return i; } // 改改改改改改改 int permute() { return i = i * 47; } }; #endif // USEFUL_H 清清清清清清清清 CIMS 清清 清清清清清清清清 #include "Useful.h" 清清清清清 class Y { int i; public: X x; // Embedded object Y() { i = 0; } void f(int ii) { i = ii; } int g() const { return i; } }; int main() { Y y; y.f(47); // 改改改改改改改改改改改改改 y.x.set(37); // Access the embedded object } 清清清清清清清清 CIMS 清清 清清清清清清清清 #include "Useful.h" 清清清清清 class Y { int i; X x; // Embedded object public: Y() { i = 0; } void f(int ii) { i = ii; x.set(ii); } int g() const { return i * x.read(); } // 改改改改改改改改改改改改改改改 void permute() { x.permute(); } }; int main() { Y y; y.f(47); y.permute(); } 清清清清清清清清 CIMS...
View Full Document

Ask a homework question - tutors are online