问题 填空题

试题源程序文件清单如下:
//proj1. cpp
#include<iostream>
using namespace std;
class MyClass
public:
MyClass():count(0) cout<<"This object is";
//ERROR********found********
void Inc() const (1)
cout<<"no."<<++count<<endl;


private:
//ERROR********found********
int count=0;(2)
;
int main()
MyClass*obj=new MyClass;
//ERROR********found********
* obj.Inc(); (3)
return 0:

答案

参考答案:obj->Inc();或(*obj).Inc();

解析: obj为MyClass类的指针,应采用指针调用成员函数的方式。

解答题
单项选择题