第十章 复习题

来源:互联网 发布:华育杯网络作文投稿 编辑:程序博客网 时间:2024/06/05 05:53

1到4问题都太抽象了,这里就略过了

5.

class Account

{

private:

string name;

int ID;

double deposit;

public:

show();

void add();

void withdraw();

}

6.

构造函数在声明一个类的对象的时候调用,析构函数在这个对象使用结束之后调用


7.

Account::account(string name1, int id, double d) {

name = name1;

ID = id;

deposit = d;}


8 也略过了


9. const string nameShow() const {

return company;}

const int sharesShow() const {

return shares;}


10. this 是对象的地址,*this是对象本身


0 0
原创粉丝点击