#include <iostream>
using namespace std;
class Tree {
private:
int ages;
public:
Tree(int ages=0):
ages(ages){}
void grow(int years) {
ages += years;
}
int getAges()const {
return ages;
}
};
int main() {
Tree tree(10);
tree.grow(5);
cout << "The ages of the tree is:" << tree.getAges() << endl;
}
标签:int,tree,ages,years,5.13,Tree From: https://www.cnblogs.com/lml66/p/17398522.html