August 2012
Intermediate to advanced
976 pages
30h 17m
English
Inside TextQuery we declared QueryResult but did not define it. As with member functions, nested classes must be declared inside the class but can be defined either inside or outside the class.
When we define a nested class outside its enclosing class, we must qualify the name of the nested class by the name of its enclosing class:
// we're defining the QueryResult class that is a member of class TextQueryclass TextQuery::QueryResult { // in class scope, we don't have to qualify the name of the QueryResult parameters friend std::ostream& print(std::ostream&, const QueryResult&);public: // no need to define QueryResult::line_no; a nested class can use a member // of its ...
Read now
Unlock full access