- 论坛徽章:
- 0
|
原帖由 Cu_fans 于 2008-7-31 11:40 发表 ![]()
你的g++竟然连#include 这样的都能通过
我觉得是你编译器太旧的缘故,这里不需要重载赋值操作符的。
不好意思,我贴的编译信息不完整,完整的如下所示:
[root@localhost CH14]# g++ -o test test.cpp
In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,
from test.cpp:1:
/usr/include/c++/3.2.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
test.cpp: In function `int main()':
test.cpp:31: no matching function for call to `Student::Student(Student)'
test.cpp:13: candidates are: Student::Student(Student&)
test.cpp:7: Student::Student(char* = "no name") | 只不过前边那个warning的原因我知道,改成
#include <string.h>
using namespace std; | 就可以了.为了突出主要问题,就只贴了我不明白的那部分.
[ 本帖最后由 happy_flying 于 2008-7-31 14:38 编辑 ] |
|