很简单,菜鸟求教
- C/C++ code
#include<iostream>using namespace std;class Point {public: int x; int y; void output() { cout<<x<<endl<<y<<endl; }};void main() { Point pt; pt.x=5; pt.y=5; pt.output;}应该是输出 5 5吧,VC6.0 没有输出 感觉有问题 就卸载原来的,重装了个新的,还是不行 求教~~~~~
[解决办法]
...
主函数中pt.output//改为pt.output()
[解决办法]
- C/C++ code
#include <iostream>using namespace std;class Point{public: int x; int y; void OutPut(){cout << x << endl << y << endl;}};int main() //没明白你要干嘛...{ Point pt; pt.x = 5; pt.y = 5; pt.OutPut(); //你少加了() return 0;}
[解决办法]
pt.output();
[解决办法]
你的编译器能编译过?是什么环境?
[解决办法]
pt.output();
输出5
5
[解决办法]
++[解决办法]
最后应该是pt.output()
[解决办法]
珍爱生命,远离vc6.0
[解决办法]
楼上两位正解
[解决办法]
在pt.output后加个括号就行!