c++ - Allow nested struct to have an instance of containing class -
I declare a path within a path square and a static example, around the constraints of the constants Constant Constant C ++ The path of the path I am trying to hang on also in the square:
class path {struct StaticPathState {path executable path; } Static Static Pathstate s_staticPathState; }; ... Path :: Static Pathstate Path :: M_Static State; However, I am receiving the compilation error: C2079: 'Path :: Static PathState :: Executable' Using the Undefined Class 'Path'
Any way to get around this? Do I have to declare structure outside the path?
What am I doing // Path {static path s_executablePath; Static path initExecutablePath (); } //.cpp path path :: initExecutablePath () {...} path path :: s_executablePath = path :: initExecutablePath (); It seems silly to not do this in the first place C # was spent too much time in the land.
Edit: That is the feature which I am trying to repeat. EDIT2: So this problem is that I need to run some code to run executable path member in a language with static constructor, I have an executable path in the path class, a static Keep it as a member, and start it in the static constructor of the path. In C ++, I'm not sure where to put this code.
Forward announcements here are your friends:
class path {struct StaticPathState; Fixed Static Pathstate s_staticPathState; }; Structure Path :: Static Pathstate {Path Execution Path}; }; Path :: StaticPathState Path :: m_staticState; But keep in mind that this is very idiomatic C ++ and will probably confuse the keepers of any future. Do not try to write another language in C ++ if you tell us the real problem that you are trying to solve, we can help solve it.
EDIT: Reading comments one more time, it seems almost like you are looking for members of a stable class class who are their own creatures, have you tried to do this?
Comments
Post a Comment