.. | ||
object.cpp | ||
readme.md |
ComposedClass
- Uncomment each of the 'cout' statements, explain why it doesn't compile:
- privateVar
- protectedVar
- object.privateVar
- object.protectedVar
- Uncomment the declaration of privateVar and protectedVar inside the ComposedClass definition.
- Which of the 'cout' statements can now be successfully compiled? Why?
- ComposedClass probably needs to interact with _object_ members. How will you give it access?
DerivedClass
- Uncomment each of the 'cout' statements, determine which successfully compiles and explain why or why not:
- privateVar
- protectedVar
- ObjectClass::privateVar
- ObjectClass::protectedVar
- How is it that you redefined _print()_ in the derived class, and yet you can still call _print()_ in the ObjectClass?
- In main, the declaration of isAobject_4_5(4,5) is commented out because it will not compile. Why not? There isn't a constructor for DerivedClass with no parameters and that works.
- Uncomment the DerivedClass constructor that has no parameters (i.e. 'DerivedClass() :' ). - Determine which of the cout statements compiles and explain why.
- Uncomment the members privateVar and protectedVar in DerivedClass, and modify comments in the code so that DerivedClass() : sets those vars to 20 and 25.
- Report the values for each 'cout' in Derived and explain the results.
- In main, now fix DerivedClass so that the statement 'DerivedClass isAobject_4_5(4,5)' works.