#include "stdafx.h"
using namespace System;
class Calculater; // how to tell the compiler that the class is down there?
int main(array<System::String ^> ^args)
{
::Calculater *calculater = new Calculater();
return 0;
}
class Calculater
{
public:
Calculater()
{
}
~Calculater()
{
}
};
即時聲明main之後的類,我如何告訴編譯器我的類是?我試過
class Calculater;主要之前,但它不工作。後C++類聲明?
爲什麼這不是功能的情況下? –
也就是說,在將其定義到編譯器之前,您不能使用函數。區別在於函數的** body **可以是任何地方,因爲它是鏈接器,可以解析您調用的實際代碼所在的位置。但編譯器仍然需要知道函數定義是什麼樣的。 –