Tag: C# inheritance

How to stop class inheritance in C++ with condition that object creation should be allowed

Answer includes multiple solutions to stop or prevent class inheritance in C++ with condition that object creation of the class should be allowed with C++ program example and explanation. Interview Question: I want to stop a class to be inherited and allow to create an object of the class. Design a solution for this problem…

Read the full article

What is method overriding in C# inheritance? Explain with real time example

Method overriding in c# with real time example – In c# interview, we need to explain overriding definition with program example and when to use method overriding in c# inheritance . We will explain method overriding with real time example for this interview question. Answer: Method overriding is a feature that allows to invoke child…

Read the full article

Up-casting and Down-casting in C# Inheritance – Interview QA

Answer: Explanation of Up-casting and Down-casting in C# inheritance with program example C# Up-Casting Assignment of derived class object to a base class reference in C# inheritance is known as up-casting. As, Up-casting is implicit any explicit typecast is not required. For example, in below program in main() method assignment of derived class “Circle” object…

Read the full article