C# inheritance

C# Inheritance – programs for practice

Q) What is output of below C# code? Output: Car is running Explanation: In fact, this is name hiding feature in C# language. If base class and derived class have same method name and have not used virtual and override in base and derived class respectively then on creating object of derived class and assigning […]

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 […]

What is method hiding in C# inheritance? Uses with example

Method hiding in C# inheritance and when to use method hiding interview question is frequently asked interview question we should focus on. Method hiding in C# program is also called method name hiding. We will answer what is method hiding in C# language with example program. Answer: Method hiding occurs in inheritance relationship when the […]

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 […]

Up-casting and Down-casting in C# Inheritance

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

Scroll to top