易截截图软件、单文件、免安装、纯绿色、仅160KB

c/c++类成员函数的传参问题!详细问题求高手解答。。

#include <iostream>
#include <string>
using namespace std;
class Student
{
public:
void get_value()
{cin>>num>>name>>sex;}
void display()
{
cout < <"num:" < <num < <endl;
cout < <"name:" < <name < <endl;
cout < <"sex:" < <sex < <endl;
}
private:
int num;
string name;
char sex;
};
class Student1:public Student
{
public:
void display_1(int &age,string &addr)
{
cout < <" age:" < <age < <endl;
cout < <"address:" < <addr < <endl;
}
int age;
string addr;
};
int main()
{
Student1 stud;
stud.get_value();
stud.display();
stud.display_1(10,"haha");
return 0;
}

用VS2005编译 报这个错误Student1::display_1”: 不能将参数 1 从“int”转换为“int &”
请问 如果我非要stud.display_1(10,"haha");
void display_1(int &age,string &addr)
要怎么写?
你要把引用去掉,写成display_1(int, string );

引用
你要把引用去掉,写成display_1(int, string );

编译通过了 但是值感觉还是没传过去啊

4 str m


相关问答:

C 程序问题 (二) - C/C++ / C语言

问一下:
#include <stdio.h>
int main()
{
  char x, y, z;
  int i;
  int a[16];
  for(i=0; i<=16; i++)
  {
  a[i] = 0;
  ......

C#调用 C DLL问题,懂的来抢分了

//C 接口
extern "C"
{
  TESSDLL_API int __cdecl GetTessText(const char *imagefile, char *text);  
}
//我在C#中声明
//调用C DLL 中的函数
[DllImport("OCRapi.dll&quo ......

用C或C++如何编写求解3D魔方程序 - C/C++ / C++ 语言

请问用C或C++如何编写求解3D魔方的程序,该从何开始?
谢谢各位,帮忙提点建议吧。

http://www.mofang.net/code/176/182/6581.html

我只能突破60秒!唉。

我刚过40秒

google的android中有个OpenGL ES + ......

C、C++、VC++ 精品电子书发布啦!

内容涉及:C、C++、STL、VC++、MFC、COM、ATL、Windows网络编程、数据库编程、Windows驱动编程、软件工程、Windows操作系统编程,等等方面。

下载地址:http://www.cctry.com/forumdisplay.php?fid=46

......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号