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 / ranjeet saini
it does not throw an exception
bcoz we can create private constructor if we have static member in class
in this we can create a reference object with the help of static method.
class A
{
private A()
{
C.w.l(" Hi");
}
public static display()
{
return new A();
}
S V M ( S[] args)
{
A a=a.display()
}
}
| Is This Answer Correct ? | 1 Yes | 4 No |
Post New Answer View All Answers
What is the difference between list and ilist in c#?
What are the different types of assemblies available and their purpose?
How do I get deterministic finalization in c#?
Is it possible to inline assembly or il in c# code?
Whats an assembly? Describe the importance of assembly?
Which string method is used for concatenation of two strings in c#?
What does f mean in c#?
What are object pooling and connection pooling and difference? Where do we set the Min and Max Pool size for connection pooling?
What is binding in c#?
What is uint c#?
What are tuples c#?
What is the difference between add and addrange in c#?
Name some properties of thread class.
What are assemblies?
Can we have two main methods in c#?