/*---------------------------------------------------------------------------
File name: stdc++.cpp
Author: HJin (email: fish_sea_bird [at] yahoo [dot] com )
Created on: 8/29/2007 15:51:23
Environment: Windows XP Professional SP2 English +
Visual Studio 2005 v8.0.50727.762
Following C++ source code compiles under VC 2005. It won't compile under g++.
Your task is to select the delcarations which are conformant to standard C++.
*/
#include <iostream>
using namespace std;
class A
{
public:
A(int i_=0) : i(i_)
{
}
private:
int i;
};
int main()
{
// which way is standard C++?
A* pA1 = new A; // A
A* pA2 = new A(); // B
A* pA3 = new A[5](); // C
A* pA4 = new A[5]; // D
return 0;
}
[此贴子已经被作者于2007-8-30 6:51:52编辑过]