1
// t1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
struct Origin
{
Origin(int _x=0, int _y=0) : x(_x), y(_y) {}
int x;
int y;
};
struct Extents
{
Extents(int _width=0, int _height=0) : width(_width), height(_height) {}
int width;
int height;
};
class Rectangle
{
public:
Rectangle(const Origin& o, const Extents& e) : m_origin(o), m_extents(e) {}
Origin m_origin;
Extents m_extents;
};
int _tmain(int argc, _TCHAR* argv[])
{
Rectangle w(Origin(), Extents()); // declare a function 'w'
Origin o(1, 2);
Extents e(3, 4);
Rectangle w2(o, e); // define a variable 'w2'
return 0;
}
질문> 우리시피 w
함수 선언한다. w2
은 변수의 정의입니다. 컴파일러 또는 언어 관점에서 볼 때 서로 다른 주요 차이점은 무엇입니까? o
및 e
이 변수는 및 종류로서 해석 될 수없는 반면간의 차이 (원점(), 확장 영역())와 직사각형 (W2) (O, E)
"Most vexing parse"를 검색하십시오. – kennytm