Q) What is output of C# code? Output:Base class constructorChild class constructorExplanation: In inheritance C# oops relationship, when we create object of a derived or child class then first base class constructor then derived class constructor get called. Q) What is output of below C# code example? Output: Compiler error – constructor re-definition Compiler error […]
C# abstract class- programs for practice
Q) What is output of the following program? Output: Answer: BWe cannot create an instance of the abstract class in c# programming. Q)What is issue in the below C# class? Answer: A method cannot have a body which is marked as abstract. Below is the correct declaration. The class derived from it will implement the […]
C# Interface – Programs for Practice
Q) What is output of C# code? Output:Saving AccountProcess saving accountExplanation: Saving Account class inherits an interface and implement its methods in the class. Note that if a class inherits an interface in C# programming, then class must implement all the methods and properties of interface or interfaces if we inherit multiple interfaces. You can […]
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 […]