class A
{
private:
	int a;
public:
	A(int x) :a(x){}
	void display(){ cout << a << endl; }
	void display()const{ cout << "ddd" << endl; }
};

void f(A a)//因为下面数据是常量,不能用&;因为用const就不能使用display
{
	a.display();
}
int main()
{
	A a(2),A  b('a');//隐式转换
	f('3');//隐式转换
	f(2);//影视转换
	A c = 13;//隐式转换
	a.display();
	b.display();
	c.display();
}

  

相关文章:

  • 2021-06-15
  • 2022-12-23
  • 2022-01-24
  • 2021-09-28
猜你喜欢
  • 2021-05-15
  • 2022-12-23
  • 2022-12-23
  • 2022-03-03
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
相关资源
相似解决方案