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 does void mean unity?

498


How long does it take to learn c# programming?

469


What is the difference between abstraction and encapsulation in c#?

492


How many variables do you need?

492


Can bool be null c#?

499






What is xml serializer?

492


Classes and structs can be declared as static, is this statement true or false?

549


What is COM Interoperability?

550


What is difference between override and new in c#?

508


What is single dimensional array in c#?

492


How do I create a single-file assembly?

476


Can you access a hidden base class method in the derived class?

496


How many bytes is a long c#?

459


Can you use foreach iteration on arrays in c#?

600


Explain how can I get around scope problems in a try/catch?

481