Inheritance
Inheritance is an object-oriented programming mechanism that allows a class to acquire the properties and methods of another class, letting a subclass reuse and extend the behavior of a parent (base) class.
45 resources across 4 libraries
Glossary Terms(4)
Abstract Class
An abstract class is a class that cannot be instantiated directly and is designed to be subclassed, often providing shared implementation alongside one or more…
Polymorphism
Polymorphism is an object-oriented programming principle that allows objects of different classes to be treated through a common interface, with each object re…
Inheritance
Inheritance is an object-oriented programming mechanism that allows a class to acquire the properties and methods of another class, letting a subclass reuse an…
Encapsulation
Encapsulation is an object-oriented programming principle that bundles data and the methods that operate on it within a single unit (a class), while restrictin…
Study Notes(18)
GPO Scope and Inheritance
How GPO scope is controlled through linking, security filtering, WMI filtering, Block Inheritance, and Enforced links, and how conflicts are resolved.
Inheritance in Solidity
Inheritance lets contracts reuse and extend each other with the is keyword, virtual/override, super, C3-linearized multiple inheritance, and ordered constructo…
Inheritance and Interfaces
Explore how VB.NET classes reuse and extend behavior through Inherits, Overridable/Overrides, and how Interfaces define implementation-free contracts.
Inheritance in Objective-C
How Objective-C's single-inheritance class hierarchy works, including method overriding, calling super, and designated initializers.
Classes in D
How D's reference-type classes work: single inheritance, polymorphism, the Object root, and construction/destruction lifecycle.
Inheritance and Mixins
Learn how Dart classes share and extend behavior through single inheritance with extends and flexible code reuse through mixins with the with keyword.
Inheritance with Metatables
Understand how Lua uses metatables and the __index metamethod to implement inheritance chains between tables.
Inheritance in Java
Understand Java inheritance using the extends keyword, the super keyword, single inheritance rules, and the Object root class.
Inheritance in Python
How subclasses reuse and extend behavior from parent classes, and how super() and MRO resolve method lookups.
Multiple Inheritance in Python
How Python resolves method lookups across multiple parent classes using MRO (Method Resolution Order) and C3 linearization, including the diamond problem.
Inheritance in JavaScript
How the `extends` and `super` keywords let one class build on another, sharing and overriding behavior while respecting strict initialization order.
Prototypes and Prototypal Inheritance in JavaScript
The mechanism underlying every JavaScript object: how property lookups walk the prototype chain, and how `prototype`, `__proto__`, and `Object.getPrototypeOf`…
Inheritance in Kotlin
Learn how open classes, open members, and the override keyword enable single-class inheritance in Kotlin.
Inheritance in Swift
Inheritance lets a class build on a superclass's properties and methods, overriding behavior with the override keyword.
Inheritance
How single inheritance, `super().__init__()`, and method overriding let subclasses reuse and specialize parent class behavior.
Inheritance and Interfaces
Understand how PHP classes extend one another via single inheritance and implement contracts via interfaces, including method overriding rules.
Inheritance in C#
Learn how C# classes derive from a single base class to reuse and extend behavior, including virtual/override methods, base member access, and sealing.
Inheritance in Ruby
See how Ruby classes extend one another with single inheritance, how `super` calls parent implementations, and how method resolution order determines which met…
Cheat Sheets(1)
Interview Questions(22)
What is Polymorphism in OOP?
Polymorphism is the object-oriented principle that lets objects of different classes respond to the same method call in their own class-specific way.
What are the Four Pillars of OOP?
The four pillars of object-oriented programming are Encapsulation, Abstraction, Inheritance, and Polymorphism — the principles that structure code around objec…
Difference Between Interface and Abstract Class
An interface defines a contract of methods a class must implement with no state, while an abstract class can provide partial implementation and state and serve…
Composition vs Inheritance in OOP
Inheritance models an "is-a" relationship where a class derives from a parent, while composition models a "has-a" relationship where a class is built from othe…
What is Inheritance in OOP?
Inheritance is the object-oriented mechanism by which a class (the subclass) acquires the fields and methods of another class (the superclass), enabling code r…
What is Method Overriding in OOP?
Method overriding is when a subclass provides its own implementation of a method already defined in its superclass, using the same name and signature.
What is the Liskov Substitution Principle?
The Liskov Substitution Principle (LSP) states that objects of a subclass must be substitutable for objects of the base class without altering the correctness…
What is Multiple Inheritance?
Multiple inheritance is when a class inherits fields and methods from more than one parent class simultaneously, combining their behavior into a single subclas…
What is the Template Method Pattern?
The Template Method pattern is a behavioral design pattern where a base class defines the fixed skeleton of an algorithm in a single method, deferring specific…
What Does super Do in OOP?
"super" is a keyword used inside a subclass to call a method or constructor defined on its parent class, most commonly to invoke the parent constructor or to e…
Public vs Private vs Protected
"public" members are accessible from any class anywhere, "private" members are accessible only within the declaring class itself, and “protected” members are a…
What is a Sealed Class?
A sealed class is a class (or interface) that explicitly restricts which other classes are allowed to extend or implement it, using a “permits” clause naming t…
What is a Final Class in OOP?
A final class is a class declared with the final keyword so it cannot be subclassed by any other class, locking its implementation as the end of the inheritanc…
Concrete Class vs Abstract Class
A concrete class is a fully implemented class that can be instantiated directly with `new`, while an abstract class may leave one or more methods unimplemented…
Liskov Substitution Violation: A Concrete Example
A classic Liskov Substitution Principle violation is a Square class extending a Rectangle class: because setting a Square’s width must also change its height (…
What is Replace Conditional with Polymorphism?
Replace Conditional with Polymorphism is the refactoring that removes a branching statement — usually a switch or if/else chain keyed on an object’s type — by…
Extension Methods vs Inheritance
Extension methods add standalone utility behavior to an existing type from outside, with no new subtype or state, while inheritance creates a genuine subtype t…
What is Constructor Chaining? Explained
Constructor chaining is the technique of one constructor invoking another constructor — either in the same class via `this(...)` or in the parent class via `su…
this() Constructor Call vs super() Constructor Call
`this(...)` invokes another constructor of the same class, while `super(...)` invokes a constructor of the immediate parent class, and both must appear as the…
What is a Protected Constructor?
A protected constructor is a constructor accessible only to the class itself, its subclasses, and (in Java) other classes in the same package, so it can be use…
What is Object Slicing in C++?
Object slicing happens in C++ when a derived-class object is assigned or passed by value into a base-class object, causing the derived-class-specific members a…
What is a Hook in the Template Method Pattern?
A hook in the Template Method pattern is an optional, overridable step in the base class algorithm, given a default (often empty or no-op) implementation, that…