Error C2143: syntax error : missing ';' before '*'
Why the compiler complains when you return a pointer to the object of the inner class in a method external? Suppose we have here is a template class:
So, after describing the method node min(node) and compile, the compiler complains tipo
The method should find the minimum node in the key tree from the incoming pointer and return pointer to found or NULL if no such. What's the matter?
Asked: 24-11-2012 в 07:42:23
The method should find the minimum node in the key tree from the incoming pointer and return pointer to found or NULL if no such. - 24-11-2012 в 08:18:24
And? put, nothing has changed. - 24-11-2012 в 09:26:23
This entire piece? And fully the message of the compiler, without "tipo", with the line number. I have this piece compiles fine. g++ v4.6.3 - 24-11-2012 в 09:46:32
added the description in the question - 24-11-2012 в 10:14:49
Added a second piece. On its first line the compiler responsibly says: e.c++:19:22: error: "node" is not a type name, the Number of rows can be shifted, I'm indent'om walked. - 24-11-2012 в 10:26:42
If you want to define this function outside of a class definition should be as follows:
Only problem is: how to use this feature for external users, if the return type is private. Or only for internal needs (and then its better to make private) or for user-friendly functions and classes. Think over this point.
Answered: 25-11-2012 в 01:14:44
@mikillskegg, Thank You very much! If not for your answer I would never know about such subtleties!=) Well, maybe they did, but not soon=) - 25-11-2012 в 10:04:14
And as the class can give out a pointer to the instance of a private inner class? This time.
I tried your code on Visual Studio.
In General, things are even simpler: you forgot a semicolon at the end of the class Declaration.
Answered: 24-11-2012 в 15:05:34
2-take into account, but 1st inner class still remain in private, this is the idea, but then how to do, that he could give? - 24-11-2012 в 22:10:37
@Djonny: just a counter question-and how they will benefit? this all depends. - 24-11-2012 в 22:13:24
so simple, any actions with an inner class will be implemented through public methods. - 24-11-2012 в 22:16:12
@Djonny: look at the update in the answer :) - 24-11-2012 в 22:16:37
@Djonny: then you will have to convert this class to public, otherwise nobody will be able to dostupatsya. - 24-11-2012 в 22:17:45
If I'm wrong, let the experts on this TSE the double-cross will correct me (I'm not one of them)
Answered: 24-11-2012 в 10:48:32
The solution to proletarian: cheap and no frills. - 25-11-2012 в 01:24:52