Top "Derived-class" questions

In Object Oriented languages, derived class can inherit properties and/or member functions from a base class, also called super class.

Calling the base class constructor from the derived class constructor

I have a question: Say I have originally these classes which I can't change (let's say because they're taken from …

c++ inheritance constructor visibility derived-class
Is it possible to assign a base class object to a derived class reference with an explicit typecast?

Is it possible to assign a base class object to a derived class reference with an explicit typecast in C#?. …

c# casting derived-class base-class downcast
C++ Access derived class member from base class pointer

If I allocate an object of a class Derived (with a base class of Base), and store a pointer to …

c++ inheritance pointers derived-class
Why does calling a method in my derived class call the base class method?

Consider this code: class Program { static void Main(string[] args) { Person person = new Teacher(); person.ShowInfo(); Console.ReadLine(); } } public class …

c# class derived-class
Why we do create object instance from Interface instead of Class?

I have seen an Interface instance being generated from a class many times. Why do we use interface this way? …

c# class interface derived-class
How to resolve "pure virtual method called"

I understand why this is happening, but I'm stuck trying to resolve it...here is what my code is doing …

c++ polymorphism derived-class base-class pure-virtual
How do I call a derived class method from the base class?

I have read several similar questions about this but none seem to solve the problem I am facing. The typical …

c# derived-class base-class
C#: How do I call a static method of a base class from a static method of a derived class?

In C#, I have base class Product and derived class Widget. Product contains a static method MyMethod(). I want to …

c# inheritance static base derived-class
Cast base class to derived class python (or more pythonic way of extending classes)

I need to extend the Networkx python package and add a few methods to the Graph class for my particular …

python inheritance derived-class base-class
How to Get Base Class Instance from a Derived Class

I don't know if this is possible, but I am trying to get the Base Class instance from a Derived …

c# .net inheritance derived-class base-class