Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Can we declare a class as Protected?

A class can be declared with only following access modifiers.

Abstract
Internal
Public
Sealed
Static
Extern (The extern modifier is used to declare a method that is implemented
externally

Can we inherit a private class into the public class?

No, In C#, a derived class can’t be more accessible than it’s base class. It means that you can't
inherit a private class into a public class. So always the base class should be more or equal
accessible than a derived class.

// Following will throw compilation error


private class BaseClass

public class DerivedClass : BaseClass

// Following will compile without an error


public class BaseClass

public class DerivedClass : BaseClass

Does Abstract classes contain Constructor?

YES
what is yeild keyword in .net ?

When ever user want to return a value from an iterator block and again contine
from in the iterator block we use yeild keyword it is used to return the value from a
iterator block, it is not supported in vb.net

You might also like