#include <iostream.h>
class Point
{
int x,y;
public:
void show();
Point();
~Point();
}
Point::Point()
{
x=0;
y=0;
cout<<"contructor\n";
}
Point::~Point()
{
cout<<"destructor\n";
}
void Point::show()
{
cout<<x<<":"<<y<<endl;
}
void main()
{
Point p;
p.show();
}错误信息如下:
--------------------Configuration: Cpp2 - Win32 Debug--------------------
Compiling...
Cpp2.cpp
E:\vc\ClassTest\Cpp2.cpp(11) : error C2533: 'Point::Point' : constructors not allowed a return type
E:\vc\ClassTest\Cpp2.cpp(27) : error C2264: 'Point::Point' : error in function definition or declaration; function not called
Error executing cl.exe.Cpp2.obj - 2 error(s), 0 warning(s)
还望各位大侠指点迷津,帮我改一下错,要修改后的源程序,谢谢,百分相赠
class Point
{
int x,y;
public:
void show();
Point();
~Point();
}
Point::Point()
{
x=0;
y=0;
cout<<"contructor\n";
}
Point::~Point()
{
cout<<"destructor\n";
}
void Point::show()
{
cout<<x<<":"<<y<<endl;
}
void main()
{
Point p;
p.show();
}错误信息如下:
--------------------Configuration: Cpp2 - Win32 Debug--------------------
Compiling...
Cpp2.cpp
E:\vc\ClassTest\Cpp2.cpp(11) : error C2533: 'Point::Point' : constructors not allowed a return type
E:\vc\ClassTest\Cpp2.cpp(27) : error C2264: 'Point::Point' : error in function definition or declaration; function not called
Error executing cl.exe.Cpp2.obj - 2 error(s), 0 warning(s)
还望各位大侠指点迷津,帮我改一下错,要修改后的源程序,谢谢,百分相赠
解决方案 »
- smtp协议的auth login
- mfc中在列表控件里每次排序后总会将姓名数据传给学号????
- 屏幕抓图的时候不能把透明窗口抓下来,是什么原因呢
- 急求VC++界面编程技术
- 求救! 关于HTTP数据包封装和发送的问题
- 请指点:LINK : fatal error LNK1104: cannot open file "D:\Microsoft Visual Studio\VC98\Lib\WININET.LIB"
- 那位高手懂Des算法吗,小弟高分求教!
- 求大侠帮帮忙,如何注册deskband后立即显示出来
- NT4.0最高能上到DirectX几?
- 怎么才能更好的学习好Visual C++6.0呢??
- 请教HOOK的几个问题,谢谢!!
- 如何给分割的VIEW各自配一个工具条
class Point
{
int x,y;
public:
void show();
Point();
~Point();
};<-----------------逗号不要少!!!!
class Point
{
int x,y;
public:
void show();
Point();
~Point();
};下次记得要加这个分号呀!
类的定义结束时一定要加分号!