can we create derived class object from base class c#

Answer: No. In general, When we create object of a class, its reference is stored in stack memory and object is stored in heap and address of object is assigned to class reference. For example child is the class and Child objch=new child(); is the object then Child objch is child class reference created on … Read more can we create derived class object from base class c#

What is Use of Private Constructor in C# ? Scenarios Example

Answer to interview questions, what is use of private constructor in c# language includes definition of it and when or why to use private constructors in c sharp  application with c# program example. Private Constructor in C#? Private constructor is constructor that is preceded by private access specifier. For example, below class has a private … Read more What is Use of Private Constructor in C# ? Scenarios Example

Design thread safe Singleton Class in C# Considering Performance

In, C# programming, Singleton in multi-threaded environment can produce more than one objects of singleton class if not designed properly. Where singleton class is expected to return only one of its instance. In this section, we will design the thread safe singleton class which was not designed in the answer of C# technical interview question … Read more Design thread safe Singleton Class in C# Considering Performance

How to Create Custom Exception in C# .net program? Use of it?

Implementation of user defined or custom exception in C# .net programming is simple and is implemented by extending system Exception class. We’ll answer concept of run time custom exception with a program example in C#. Custom Exception Class Custom Exception class is nothing but a user defined class which is derived from System Exception class. … Read more How to Create Custom Exception in C# .net program? Use of it?

Advantage of Immutable String in C# programming

Advantage of immutable string in C# programming is data security. Let’s understand benefits of immutable string with a C# program example. Recommended to read immutable and mutable string in C#. Here is the scenario, The main() method has a String msg = “Hello World”; and will call the display1() method and then the display2() method. … Read more Advantage of Immutable String in C# programming

Explain C# Singleton class with code example – Simple Steps

C# Singleton class is the class that allow only one of its object across the program execution. Singleton class is just a concept and in C# programming any class can be designed as singleton class which is supposed to have only one object of it. Below are the steps to design a class as a … Read more Explain C# Singleton class with code example – Simple Steps

Write code to retrieve data from SQL database in C# asp net

Here are the steps to connect SQL database server, access database and retrieve data from a table programmatically in C# asp net. Steps: Create an object of SqlConnection class Prepare connection string for SqlConnection class object. Create object of SqlCommand class and prepare sql command with types, queries and sql connection object. Open sql connection … Read more Write code to retrieve data from SQL database in C# asp net

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 base … Read more What is method hiding in C# inheritance? Uses with example

How to implement two interface with same method in C#?

Answer includes two interface with same method in C# implementation and how to call them with a c# code example. Here is the exact interview question asked : If you implement two interface with same method name in a program then doesn’t method call conflict? In another word, how to call same method from two … Read more How to implement two interface with same method in C#?

1 Scenario where C# interface is indispensable?

Interview Question: Tell one scenario where C# interface  is indispensable. For the scenario, only C# interface is the solution and abstract class cannot be used. Answer: Scenario is multiple interface inheritance. C# object oriented programming does not support multiple class inheritance, means, a class cannot inherit more than one class in C#. But, a class … Read more 1 Scenario where C# interface is indispensable?