Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is dbcontext c#?

1057


What is lazy keyword in c#?

959


Can you instantiate a struct without using a new operator in c#?

983


What are the features of c#?

978


What is the purpose of a console table?

991


Is c# difficult to learn?

905


What are the differences between value types and reference types?

1193


What is xamarin used for?

988


What is the use of private constructor in c#?

954


What is different between Static Constructor and Private Constructor?

1077


How does bitwise work?

939


What is returned if you pass the value 12.34 to the parsefloat () function?

1008


Why do we use void in c#?

915


What is sqlcommand in c#?

950


Do unused Namespaces in c# affect run-time performance?

1093