J
Jack
I'm new to Visual C++ for .NET and during learning I
encountered the following:
In Form1.h file inside class Form1 following the book
example I defined fuction that looks like this:
(file Form1.h)
void function()
{
... some code ...
MessageBox::Show(....);
... some code ...
};
This compiled and worked OK. But because I'm from the old
world of C programming I wanted to move body of the
function to the Form1.cpp file as follows:
(file Form1.h)
void function();
(file Form1.cpp)
#include "Form1.h"
.... some code ...
void Form1::function()
{
... some code ...
MessageBox::Show(...);
... some sode ...
}
The above failed to compile. It was complaining about
MessageBox being neither class nor namespace.
Why it did not compile ?
Jack
encountered the following:
In Form1.h file inside class Form1 following the book
example I defined fuction that looks like this:
(file Form1.h)
void function()
{
... some code ...
MessageBox::Show(....);
... some code ...
};
This compiled and worked OK. But because I'm from the old
world of C programming I wanted to move body of the
function to the Form1.cpp file as follows:
(file Form1.h)
void function();
(file Form1.cpp)
#include "Form1.h"
.... some code ...
void Form1::function()
{
... some code ...
MessageBox::Show(...);
... some sode ...
}
The above failed to compile. It was complaining about
MessageBox being neither class nor namespace.
Why it did not compile ?
Jack