c对象创建

来源:互联网 发布:office软件下载mac版 编辑:程序博客网 时间:2024/06/05 20:16
#include <iostream>
using namespace std;
struct Foo
{
Foo() {  }
Foo(int) {  }
void fun()   {  }
};
int main(void)
{
Foo a(10);    //语句1
a.fun();      //语句2
Foo b();      //语句3 改成Foo b;
b.fun();      //语句4
return 0;
}