mercredi 30 décembre 2015

Create a new function in the class method (C++11) [duplicate]

This question already has an answer here:

I have a class A:

class Date
{
    int myFoo1();
};
int Date::myFoo1()
{

}

I want to create myFoo2 inside myFoo1 like this:

int Date::myFoo1()
{
  int myFoo2()
  {

  }
}

I get this error:

 error: a function-definition is not allowed here before ‘{’ token
     {
     ^

How can I define such a function?

Aucun commentaire:

Enregistrer un commentaire