Can we have private constructor in our class file. When we
are trying to create instance for the class will it create
or throw error regarding that?

Answer Posted / saiish bhat

ya,we have private constructor.but it wont throw an exception.

but u cant create an instance of p.c.

it is not possible to inherit from that class also.

ex:
private class a()
{

}

class b : a
{ }

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of interface in c#?

701


Where static variables are stored?

669


Can struct have constructor c#?

688


Can we extend static class in c#?

682


how to create crystal reports give one detail example(i want to view age category report) please give suitable example in my small knowledge

1834


Explain circular reference in c#?

745


What is poco c#?

690


When a Static Constructor is called in a Class?

777


How big is int16?

712


What is stringwriter c#?

615


Which namespaces are necessary to create a localized application?

829


What is a dynamic assembly?

741


What are the methods in c#?

712


Can you specify nested classes as partial classes?

732


What is delegate in c#?

723