关于访问成员的问题?
#include<iostream>using namespace std;
class newclass{
public:
newclass(int i,int j)
{
ii=i;
jj=j;
}
void print();
private:
int ii,jj;
};
void newclass::print()
{
cout<<ii<<endl<<jj<<endl;
}
int main()
{
newclass var[2]={newclass(1,2),newclass(3,4)};
newclass *pi=&var[1];
cout<<pi->print()<<endl; //不知道为什么出错?
pi=&var[2];
cout<<pi->print()<<endl;
return 0;
}