C# Reference

General Questions:

Does C# support multiple-inheritance?
Not multiple implementation inheritance, no. But multiple interface inheritance, yes.

Can you prevent a class from being inherited by another class?
Yes, by making it ‘sealed’.

What are the differences between an Interface and a Class in C#?
An interface contains only the signatures of methods, properties, events, and indexers to be implemented by derived classes.
You cannot make instances of interfaces and they are comparable to pure virtual classes in C++.

What is an abstract class?
One that you cannot make instances of, but can derive from. It can also only have abstract members, and for abstract member functions it has, any derived class must implement those.

What is the difference between an abstract class and an Interface in C#?
The main difference is that you can inherit from multiple interfaces, which is C#’s version of multiple inheritance.
Whereas with an abstract class you can only inherit from it once. You can’t instantiate either interfaces or abstract classes.

What is the difference between value types and reference types in C#?
Structs are value types, while classes are reference types, and the runtime deals with the two in different ways.
When a value-type instance is created, a single space in memory is allocated to store the value. Primitive types
such as int, float, bool and char are also value types, and work in the same way. When the runtime deals with a value
type, it's dealing directly with its underlying data and this can be very efficient, particularly with primitive types.
With reference types, however, an object is created in memory, and then handled through a separate reference—rather like a

What is a delegate?
It's a function reference type, declared with a name and function signature.
Once you've defined the type, you can declare instances of it, to reference
functions with the same signature present in the delegate declaration.

What does the keyword 'virtual' mean?
The virtual keyword is used to modify a method, property, indexer or event declaration, and allow it to be overridden in a derived class.

What is the name of the implicit parameter that gets passed to the set method of a property of a class?

What are the implicit variables in every non-static class?
this, base