Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     

QuestPond: Interview Questions and Answers on learning .NET

What is nested Classes?

Nested classes are classes within classes.

If you create the child class object which constructor will fire first?

public class class1
public  class1(){}

public class class2 : class1
public  class2(){}

Parent class constructor will fire first.

In what instances you will declare a constructor to be private?

When we create a private constructor, we cannot create object of the class.  Private constructors are used when we want only a single instance of the class to be created and externally no one can use the ‘new’ keyword to create the object.

Can we have different access modifiers on get/set methods of a property?

Yes, we can have different access modifiers. The below code will compile perfectly well.

public string CustName
        return _Custname;
    protected set
Custname = value;

See following video on which constructor fires first in parent-child relationship: -

If you want to learn or want more on .NET learning then follow site

Helpful Website Url
Share this article   |    Print    |    Article read by 2847 times
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers
Related Articles:
Related Interview Questions: