Flashcards
INSY 4306 Ch.12
Cards in this deck (26)
- 1PolymorphismEnables you to write apps that process objects that share the same base class in a class hierarchy as if they were all objects of the base class
- 2In a method call on an object, the type of the ________, not the type of the _______, determines which method is calledactual referenced object, reference
- 3An object of a derived class can be treated as an object of itsbase class
- 4A base class object is not an object of any of itsderived classes
- 5The is-a relationship applies from a derived class to its direct and indirect base classes, but notvice versa
- 6The compiler allows the assignment of a base-class reference to a derived-class variable _______ the base-class reference to the derived-class typeif we explicitly cast
- 7DowncastingIf an app needs to perform a derived-class-specific operation on a derived-class object referenced by a base-class variable, the app must first cast the base-class reference to a derived-class reference
This enables the app to invoke derived-class methods that are not in the base class - 8When the compiler encounters a _______ method call made through a variable, the compiler checks the ______ class type to determine if the method can be calledvirtual, variable
- 9At execution time, __________ determines the actual method to usethe type of the object to which the variable refers
- 10Abstract classes or abstract base classesCannot be used to instantiate objects.
Too general to create real objects - they specify only what is common among derived classes - 11concrete classesClasses that can be used to instantiate objects.
Provides the specifics that make it reasonable to instantiate objects - 12An abstract class normally contains one ore more ________ which have the keyword ________ in their declarationabstract methods, abstract
- 13A class that contains abstract methods must be declared as an _________ even if it contains concrete (non-abstract) methods.abstract class
- 14Abstract property declarations have the form:
- 15Constructors and Static Methods cannot be declaredAbstract
- 16You can avoid a potential InvalidCastException by using the _______ operator to perform a downcastis or as
- 17Assigning a base-class reference to a base-class variable isstraightforward
- 18Assigning a derived-class reference to a derived-class variable isstraightforward
- 19Assigning a derived-class reference to a base-class variable issafe, because the derived-class object is an object of its base class. However, this reference can be used to refer only to base-class members.
- 20Attempting to assign a base-class reference to a derived-class variable is acompilation error. To avoid this error, the base-class reference must be cast to a derived-class type explicitly.
- 21A method declared ________ in a base class cannot be overridden in a derived classsealed
- 22Methods that are declared private are _________ sealed.implicitly
- 23Methods that are declared static are __________ sealedimplicitly
- 24Static BindingCalls to sealed methods (and non-virtual methods) are resolved at compile time
- 25Interface DeclarationBegins with the keyword interface and can contain only abstract methods, abstract properties, abstract indexers (not covered in this book) and abstract even
- 26Keyword operatorIndicates that a method overloads the specified operator
Information
- Description
- Flashcards on INSY 4306 Ch.12, created by Christopher Le on 09/11/2015.
- Created by
- Christopher Le
- Views
- 1
- Rating