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
は変数の定義です。 コンパイラまたは言語の観点から、それらを異なるものにする主な違いは何ですか?差(原点()、エクステント())及び長方形W2(O、E)
「Most vexing parse」を検索するだけです。 – kennytm