How-to articles, tricks, and solutions about INHERITANCE

How should I have explained the difference between an Interface and an Abstract class?

An interface is a collection of abstract methods that define a set of functions that a class must implement.

How to determine an object's class?

To determine the class of an object in Java, you can use the getClass() method of the Object class. The getClass() method returns a Class object that represents the object's class.

Implements vs extends: When to use? What's the difference?

In Java, the extends keyword is used to inherit from a superclass, and the implements keyword is used to implement an interface. Here are the key differences between the two:

Multiple Inheritance in PHP

In PHP, multiple inheritance is not supported in the traditional sense, where a class can inherit from multiple classes.

Understanding Python super() with __init__() methods

The super() function is a way to refer to the parent class and its attributes.

What are the differences between type() and isinstance()?

In Python, type() is a built-in function that returns the type of an object, while isinstance() is a function that checks whether an object is an instance of a particular class or of a subclass thereof.

What is the “new” Keyword in JavaScript

Here, you will find a quick overview of the “new” keyword in JavaScript. You need to understand it properly for the more effective usage of JavaScript.

Why do Python classes inherit object?

In Python 3, all classes automatically inherit from the object class.