~急 在线等 5000分~!很简单~!!!求教~!
主 题: 设计一个用于人事管理的模块~急 在线等
作 者: xunkan (软体动物)
等 级:
信 誉 分: 100
人 气: 0
所属论坛: C/C++ C++ / 面向对象
问题点数: 100
回复次数: 0
发表时间: 2004-4-7 19:37:42
我们在上机实习 求教~ 晚上要交
属性:
number
sex
birthday
其中birthday
为日期类的内嵌子对象
用成员函数实现对人员信息的录入和显示
要求用到构造函数
析构函数 拷贝构造函数
内联成员函数
组合
我马上要提交
#include<iostream>
using namespace std;
class tree
{
public:
tree(int n=0);
void grow(int years);
void age();
private:
int ages;
};
tree::tree(int n)
{
ages=n;
}
void tree::age()
{
cout<<"the age of the tree is "<<ages<<endl;
}
void tree::grow(int years)
{
ages+=years;
}
void main()
{
tree TREE(500);
TREE.age();
TREE.grow(300);
TREE.age();
}
分不够可以继续加 最多5000 给出完整代码~~!!! 多谢~~~