HaNoi University of TechnologyWeek 4: Inheritance – Mastering C# 2008
b) A base class’s………. members can be accessed only in the base-classdefinition or in derived-class definitions.c) In a(n) …………relationship, an object of a derived class also can betreated as an objectof its base class.d) In a(n)….. ….relationship, a class object has one or more references toobjects ofother classes as members.e) A class exists in a(n)………. relationship with its derived classes.f) A base class’s members are accessible anywhere that the program has areference to that base class or to one of its derived classes.g) A base class’s protected
access members have a level of protectionbetween those of public
and …….access.h) A base class’s…….. members can be accessed only in the same assembly.i) When an object of a derived class is instantiated, the base class’s……..is called implicitly or explicitly to do any necessary initialization ofthe base-class instance variables in the derived-class object.j) Derived-class constructors can call base-class constructors via the ……reference.
State whether each of the following is
, explain why.
a) It is possible to treat base-class objects and derived-class objectssimilarly.b) Base-class constructors are not inherited by derived classes.c) A “has-a” relationship is implemented via inheritance.d) All methods, by default, can be overridden.e) Method ToString of class System.Object is declared as virtual.f) When a derived class redefines a base-class method using the samesignature, the derived class is said to overload that base-class method.g) A Car class has an “is a” relationship with its SteeringWheel andBrakes.h) Inheritance encourages the reuse of proven high-quality software.