Money cout money wmoney234 cout money

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: 清清清清清清清清清清清清清清清清清清清清 清清清清 2 清清清清清清清清 CIMS 清清 class Tree { int height; public: Tree(int initialHeight); // Constructor ~Tree(); // Destructor 清 // ... }; 清清清清清清清清清 清清清清清清清清清清清清清清清清清清清清 清清清清清清清 清清清清清清清清 清清清清清清清清清清清清清清清清清清清清清清清清 清清清清清清清清清清清清清清清清清清清清 清清清清清清清清清清清清清清清清清清清 清清清清清清清清清清清清 3 清清清清清清清清 CIMS 清清 #include <iostream> // C++ 客客客客客 using namespace std; // C++ 客客客客客客客客客客 class Tree { int height; public: Tree(int initialHeight); // Constructor ~Tree(); // Destructor void grow(int years); void printsize(); }; 4 Tree::Tree(int initialHeight) { height = initialHeight; } Tree::~Tree() { cout << "inside Tree destructor" << endl; printsize(); } EX10: 清清清清清清清 void Tree::grow(int years) { height += years; } void Tree::printsize() { cout << "Tree height is " << height << endl; 清清清清清清清清 CIMS 清清 } int main() { cout << "before opening brace" << endl; { Tree t(12); cout << "after Tree creation" << endl; t.printsize(); t.grow(4); cout << "before closing brace" << endl; } cout << "after closing brace" << endl; } before opening brace after Tree creation Tree height is 12 before closing brace inside Tree destructor Tree height is 16 after closing brace 5 清清清清清清清清 CIMS 清清 清清清清清清清清 ► 清清清清清清清清 1. 2. 3. 6 清清清清清清清清清清清清 清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清清 清清清清清清清清 new 清清清清清清清清清清清清清 delete 清清清清清清清清清清清清清清清清 清清清清清清清清 CIMS 清清 ► 清清清清清清 C++ 清清清清客客客客客客 清 C ...
View Full Document

Ask a homework question - tutors are online