c++ - Outer class containing inner class - instantiate the inner class as a member of the outer class -
Currently I am trying to compile the following code:
terminallog.hh
#ifndef TERMINALLOG_HH # defined TERMINALLOG_HH #include & lt; String & gt; # Include & lt; Sstream & gt; # Include & lt; Iostream & gt; Class terminology {public: terminology (); Virtual ~ terminology (); Class warning {public: warning (); Private: Child lines; }; Friend class terminology :: warning; Protected: Private: Warning Warning; }; terminallog.cc
// stripped code Terminallog :: Terminallog () (this warning-> warning;} Terminology :: Warning :: Warning () {This-> lineended = true;} // hidden code OK, as you're probably estimating ARDA, its failure ;-) My compiler is saying:
G ++ src / terminallog.cc inc / terminallog.hh -o test -Wall -Werror file contains src / terminallog.cc: 8: src / ../ Inc / terminallog.hh: 56: Error: Terminallog: Warning Terminology :: Warning Src /../ inc / terminallog.hh: 24: Error: Conflict with Previous Declaration Zero Terminal :: Warning (Std :: string) a ???? Leaves me out of options I am clearly doing something wrong, although I do not know how to solve it. I appreciate any pointers.
thanks in advance
ftiaronsem
Warning (); Valid C ++ syntax is not valid - If you want to initialize the warning member, then use the initial list (in this case - the default constructor is said to be contained!). . Terminallog :: Terminology (): Warning () {// Other Constructor Code} // Note that 'Warning: Warning ()' applies to 'awake' inherently applied , Then Terminal Log :: Terminology () {} // will be
Comments
Post a Comment