What is inheritance in object-oriented programming?
Inheritance defines a new class from an existing class, allowing it to receive accessible members, add members, or change inherited behavior.
Study 4 Inheritance with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is inheritance in object-oriented programming?
Inheritance defines a new class from an existing class, allowing it to receive accessible members, add members, or change inherited behavior.
What are the two main class roles in inheritance?
The base class is the existing superclass or parent; the derived class is the new subclass or child that inherits from it.
When is composition preferable to inheritance?
Inheritance should model an is-a relationship. Composition is usually better when one object merely contains or uses another, such as a Car having an Engine.
What does Bicycle inherit from Vehicle?
Bicycle is a Vehicle, so Bicycle can reuse Vehicle's inherited speed field and stop() method while adding gear and changeGear().
What does transitive inheritance mean?
Inheritance is transitive: if MountainBike derives from Bicycle and Bicycle derives from Vehicle, MountainBike also receives Vehicle's inherited behavior.
Are constructors generally inherited?
Constructors are generally not inherited. A derived constructor initializes its own state and may invoke a base-class constructor.
What does specialization mean in inheritance?
Specialization lets a derived class represent a more specific form of the base concept by adding behavior or details that distinguish it.
What is method overriding?
Overriding replaces an inherited instance method with a compatible implementation in the derived class, such as Dog replacing Animal.speak() with “Bark.”
How do overriding and overloading differ?
Overriding changes inherited behavior in a derived class; overloading defines methods with the same name but different parameter lists.
How can an override extend base behavior?
In Java, super can call the base implementation from an overriding method before the derived method adds its own behavior.
What is polymorphic use of a derived object?
Polymorphism allows a derived object to be used where its base type is expected, while the runtime object determines which override runs.
What determines an overridden method at runtime?
Runtime dispatch selects the method implementation according to the object's runtime type, so an Animal reference holding a Dog calls Dog's speak().
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
Learn how Boolean expressions, logical operators, and conditional structures let programs make reliable decisions, including how to handle boundaries, branch order, and testing.
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.