Unit 9: Inheritance Flashcards
Abstraction
The process of simplifying complex systems by focusing on essential features while hiding unnecessary details. It allows programmers to work with high-level concepts without worrying about implementation specifics.
Classes
User-defined data types in object-oriented programming. They serve as blueprints for creating objects by defining their attributes and methods.
Creating Superclasses and Subclasses
Involves designing and implementing relationships between classes in an object-oriented program. Superclasses provide common attributes and behaviors that can be inherited by subclasses, allowing for code reuse and organization.
Data Structures
Ways to organize, store, and manipulate data efficiently. They provide different methods of accessing, inserting, deleting, or searching for data elements based on specific requirements.
Diamond Problem
Refers to an issue that arises in multiple inheritance when two superclasses share a common superclass, resulting in ambiguity for subclasses on which superclass’s method to use.
Instance Variables
Variables declared within a class but outside any method. They hold unique values for each instance (object) of the class and define the state or characteristics of an object.
Object-Oriented Programming
A programming paradigm that organizes code into objects, which are instances of classes. It focuses on creating reusable and modular code by encapsulating data and behavior together.
Static Typing
A programming language feature that requires variables to be declared with their data types before they can be used. It helps catch errors at compile-time by enforcing type compatibility.
Subclasses
Classes that inherit properties and behaviors from superclasses. They can add additional attributes or override existing ones to create specialized versions of the superclass.
Superclasses
Refer to classes that other classes inherit from. They contain common attributes and behaviors that can be shared by multiple subclasses.
The Object Superclass
The root class in Java and many other object-oriented programming languages. All classes are derived from this superclass either directly or indirectly.
Constructors
Special methods within classes that are used to initialize objects when they are created. They have the same name as the class and are called automatically when an object is instantiated.
Inheritance Hierarchy
Represents the relationship between classes where one class inherits properties and behaviors from another class. It forms a hierarchical structure with parent and child classes.
Method Signature
Refers to the unique combination of a method’s name and its parameter types. It helps distinguish one method from another.
super keyword
Used in Java to refer to the superclass of a subclass. It allows access to the superclass’s methods, constructors, and instance variables.
extends SuperClassName
This keyword is used in object-oriented programming to establish an inheritance relationship between classes. It allows a subclass to inherit properties and behaviors from a superclass.
Inheritance
A concept in object-oriented programming where a class inherits the properties and behaviors of another class. It allows for code reuse and promotes the creation of hierarchical relationships between classes.
Methods
Functions defined within a class that perform specific tasks or actions when called upon by an object. They can manipulate data, interact with other objects, or return values.
Polymorphism
Refers to the ability of objects to take on multiple forms or have multiple types. In programming, it allows different objects to be treated as instances of a common superclass, enabling flexibility and extensibility.