西昌烟草公司招聘2018:VC错误:term does not evaluate to a function是什么意思?是不是a是一个常对象,不能更新
来源:百度文库 编辑:中科新闻网 时间:2024/05/06 04:09:46
#include <iostream.h>
class A
{
public:
A(int i,int j)
{
x=i;
y=j;
}
void getx() const;
void gety() const;
private:
int x;
int y;
};
void A::getx() const
{
cout<<"x="<<x<<endl;
}
void A::gety() const
{
cout<<"y="<<y<<endl;
}
int main()
{
A const a(3,4);
a.getx();
a.gety();
a(5,6); //该行出现了这个错误
a.getx();
a.gety();
return 1;
}
class A
{
public:
A(int i,int j)
{
x=i;
y=j;
}
void getx() const;
void gety() const;
private:
int x;
int y;
};
void A::getx() const
{
cout<<"x="<<x<<endl;
}
void A::gety() const
{
cout<<"y="<<y<<endl;
}
int main()
{
A const a(3,4);
a.getx();
a.gety();
a(5,6); //该行出现了这个错误
a.getx();
a.gety();
return 1;
}
a 是 const,所以不可以在改变值
a(5,6);这样写本身也是不对的
这样不会调用其构造函数的
共一个对象的构造函数只会调用一次
你需要另加一个成员函数来设置x,y的值
比如
void Set( int i, int j)
{
x = i;
y = j;
}
或者采用
A* a= new A(3,4);
a = new A(5,6);
a(5,6);
他不是一个函数
VC错误:term does not evaluate to a function是什么意思?是不是a是一个常对象,不能更新
为什么随机数生成时 总是报错term does not evaluate to a function?
IIS出现class does not exist这个错误怎么解决
e-term系统
canva does not drawing
JSP提示name.java:2: package javax.servlet does not e
He does not spite in public places.中的spite是什么意思?还是在句中使用错误
关于IIS错误问题在去掉显示友好的HTTP信息出现class does not exist
it does not matter!是什么意思.
Warning: Superclass does not exist