This question already has an answer here:
- C++ can we have functions inside functions? 11 answers
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