if my class is private and constructor is public then what will happen. can i create a instance of that class or other class can i extend? i just need to know why and when people create a private class with public ctor?
the code like
private class LazyResource
{
SomeBigResource _heavyObject = null;
public SomeBigResource LazyLoad
{
get
{
if (_heavyObject == null)
_heavyObject = new SomeBigResource();
return _heavyObject;
}
}
}
plzz guide me thanks
You can't create a non-nested private class in C#.
This is almost certainly a nested class, in which case only the containing type can instantiate an instance of it. And if
LazyResource
only had a private constructor then nothing would be able to instantiate it (except for a static member ofLazyResource
itself).