a. 11. void print() const; b. void set(int, int, int); void get(int&, int&, int&); First a constructor of will execute, then a constructor of will execute, and 13. class one class two finally a constructor of will execute. class three a. Invalid. is an instance variable of the derived it cannot be accessed by the members of 15. z the class smart. b. Invalid. is a private member of the It cannot be accessed directly secret class smart. outside of the class. Also is a private member of the It cannot be z class superSmart. accessed directly outside of the class. c. Valid d. Invalid. is the name of a class, not an object of this class. It cannot be used to call its smart member function print. e. Invalid. is the name of a class. It cannot be used to access its members. superSmart Between the preprocessor directive and The definitions of the classes 17. #ifndef #endif. one and can be placed between these directives as follows: two #ifndef H_one #ifndef H_two #define H_one #define H_two //place the definition of the //place the definition of the //class one here //class two here #endif #endif In a inheritance, the members of the base class are members of the 19. private public public derived class. They can be directly accessed in the derived class. The members of protected the base class are members of the derived class. They can be directly accessed by protected the member functions (and functions) of the derived class. The members of friend private the base class are hidden in the derived class. They cannot be directly accessed in the derived class. They can be accessed by the member functions (and functions) of the derived friend class through the or members of the base class. public protected
11. a. void print() const; b. void set(int, int, int); void get(int&, int&, int&); 13. First a constructor of class one will execute, then a constructor of class two will execute, and finally a constructor of class three will execute. 15. a. Invalid. z is an instance variable of the derived it cannot be accessed by the members of the class smart. b. Invalid. secret is a private member of the class smart. It cannot be accessed directly outside of the class. Also z is a private member of the class superSmart. It cannot be accessed directly outside of the class. c. Valid d. Invalid. smart is the name of a class, not an object of this class. It cannot be used to call its member function print. e. Invalid. superSmart is the name of a class. It cannot be used to access its members. 17. Between the preprocessor directive #ifndef and #endif. The definitions of the classes one and two can be placed between these directives as follows: #ifndef H_one #ifndef H_two #define H_one #define H_two //place the definition of the //place the definition of the //class one here //class two here #endif #endif 19. In a private inheritance, the public members of the base class are public members of the derived class. They can be directly accessed in the derived class. The protected members of the base class are protected members of the derived class. They can be directly accessed by the member functions (and friend functions) of the derived class. The private members of the base class are hidden in the derived class. They cannot be directly accessed in the derived class. They can be accessed by the member functions (and friend functions) of the derived class through the public or protected members of the base class.