【文件属性】:
文件名称:类与对象实验
文件大小:39KB
文件格式:DOC
更新时间:2017-01-13 04:31:14
实验 类对象 实验报告
有关类与对象的程序算法设计:1.试分析以下程序的运行结果并上机验证.
#include
class Sample
{
int x;
public:
Sample(){}
Sample(int a){x=a;}
Sample(Sample &a){x=a.x+++10;}
void disp(char *ob)
{ cout<
class Son
{
int age;
public:
Son(){ age=1;}
Son(int i){age=i;}
void print(){ cout<<"儿子的年龄是:"<
class score{
float english_score;
public:
score(float t){english_score=t;}
void printscore(){cout<<”english_score=”<
class Sample
{
int x;
public:
Sample(){}
Sample(int a){x=a;}
Sample(Sample &a){x=a.x+++10;}
void disp(char *ob)
{ cout<
class Son
{
int age;
public:
Son(){ age=1;}
Son(int i){age=i;}
void print(){ cout<<"儿子的年龄是:"<
class score{
float english_score;
public:
score(float t){english_score=t;}
void printscore(){cout<<"english_score="<