This code simply declares a local function, and has an empty scope for fun:
myClass::myClass()
{
void DoSomething(); // local function declaration
{
// empty scope
}
}
If you want doSomething()
to be a member of myclass
, you have to declare it in the class definition:
class myClass
{
public:
myClass();
~myClass();
void doSomething();
};
then implement it
void myclass::doSomething() { .... }
Also note that you don't have to use new
everywhere in C++. You can instantiate an object like this:
int main()
{
myClass mc;
}
Also note that using namespace std;
isn't such a great idea anyway, at least not in real code.