Hej! Tack!Spel-programmering
Jag läser en introduktionskurs i spel-programmering,
http://msdn.microsoft.com/coding4fun/gamedevelopment/beginning/default.aspx,
och nu har jag ett problem:
När jag deklarerar funktionen
<code>
protected:
override void OnPaint(PaintEventArgs^ e)
{
this->Invalidate();
}
</code>
får jag felmeddelande:
1>------ Build started: Project: BattleTank2005, Configuration: Debug Win32 ------
1>Compiling...
1>BattleTank2005.cpp
1>h:\programmering\visual c++ 2005\battletank2005\battletank2005\Form1.h(45) : error C4485: 'BattleTank2005::GameEngine::OnPaint' : matches base ref class method 'System::Windows::Forms::Form::OnPaint', but is not marked 'new' or 'override'; 'new' (and 'virtual') is assumed
1> c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : see declaration of 'System::Windows::Forms::Form::OnPaint'
1> Specify 'override' (and 'virtual') to override the ref class virtual method
1> Specify 'new' (and 'virtual') to hide the ref class virtual method with a new virtual method
1> Position for 'new' and 'override' keywords is after method parameter list
1>Build log was saved at "file://h:\Programmering\Visual C++ 2005\BattleTank2005\BattleTank2005\Debug\BuildLog.htm"
1>BattleTank2005 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Vad gör jag för fel?
Jag använder Visual C++ 2005.
/MagnusSv:Spel-programmering
Jag fick felmeddelande då också,
men jag behövde bara lägga till virtual så löste det sig.
/Magnus