1/18
Flashcards covering key concepts related to inheritance, polymorphism, and related topics in object-oriented programming.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is a subclass?
A class that inherits properties and behaviors from another class (superclass).
What is another term for subclass?
Child or derived class.
What is a superclass?
A class from which other classes inherit (also known as parent or base class).
What is code inheritance?
The mechanism by which a subclass acquires the properties and methods of its superclass.
What is composition in programming?
A design technique where a class contains objects of other classes as instance variables.
Define Composite Type
A type or class composed of other types or Classes.
What is multiple inheritance?
A feature where a class can inherit from multiple superclasses.
What is the diamond problem, and why is it significant?
An ambiguity that arises when a class inherits from two classes that have a common ancestor; it creates issues in determining which version of a method to inherit.
What is delegation in object-oriented design?
A design pattern where an object handles a request by passing it to another object (delegate).
What is abstract class?
A class that cannot be instantiated and is designed to be a base class for other classes.
What does 'protected access' mean in the context of class members?
A member that is accessible within its own class, its subclasses, and other classes in the same package.
What is constructor chaining?
The process of calling one constructor from another constructor within the same class or from a superclass.
What is static polymorphism?
Polymorphism that is resolved at compile time (also known as compile-time polymorphism).
What is dynamic polymorphism?
Polymorphism that is resolved at runtime (also known as runtime polymorphism).
What is an upcast?
Converting a subclass reference to a superclass reference.
What is a downcast?
Converting a superclass reference to a subclass reference.
What is a ClassCastException?
An exception thrown when attempting an illegal downcast.
What is the purpose of the 'instanceof' operator?
An operator used to check if an object is an instance of a particular class or interface.
What are enumerated types?
A data type consisting of a set of named constants.