What is INHERITANCE in object-oriented programming?
- **A)** A mechanism where two classes share no relationship at all
- **B)** Copying and pasting a class's entire code into a new, unrelated class
- **C)** A mechanism where a new class (the SUBCLASS) is defined based on an EXISTING class (the SUPERCLASS), automatically gaining that superclass's instance variables and methods, while being able to add or override its own
- **D)** A synonym for encapsulation
Inheritance lets a subclass reuse and extend a superclass's functionality, avoiding duplicated code between related classes.