Multiple Inheritance in C#

Does C# support multiple Inheritance ?

No, you cannot inherit from multiple classes. You may use interfaces or a combination of one class and interface(s).

More about.....Multiple inheritance in C#

How do you prevent a class from being inherited ?

multiple Inheritance in C#

In C# you can use the "sealed" keyword in order to prevent a class from being inherited. If you try to attempts to inherit will result in a compilation error.

In VB.Net you can use "NotInheritable" (NonOverrideable for properties)

Also in Java you can use the keyword "final"

More about.....Sealed Classes

Explain namespaces in C# ?

C# Interview questions and answers

Namespaces are containers that is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.

Within a namespace, you can declare another namespace, class, interface, struct, enum, and delegates.


More about......Net namespaces

How do you convert a value-type to a reference-type ?

You can use Boxing.

What is boxing and unboxing ?

Implicit conversion of value type to reference type of a variable is known as boxing and conversion of reference type variable back to value type is called as UnBoxing.


More about.....Boxing and Unboxing
 (C) 2022    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About