C Sharp - private instance and public instance
I have class named(productdetails) , in that i am implementing singleton DP, now the doubt isprivate static ShoppingCart ShoppingCartInstance;
public static ShoppingCart GetShoppingCart()
{
if (ShoppingCartInstance == null)
{
ShoppingCartInstance = new Business.ShoppingCart();
}
return ShoppingCartInstance;
}
why i am making one private instance and public instance, instead of writing private instance i can write directly public instance.
why i need this private instance.
Regards,
Naresh.