c# - Regarding OOPS & Private class -
if class private , constructor public happen. can create instance of class or other class can extend? need know why , when people create private class public ctor?
the code like
private class lazyresource { somebigresource _heavyobject = null; public somebigresource lazyload { { if (_heavyobject == null) _heavyobject = new somebigresource(); return _heavyobject; } } }
plzz guide me thanks
you can't create non-nested private class in c#.
this nested class, in case containing type can instantiate instance of it. , if lazyresource
had private constructor nothing able instantiate (except static member of lazyresource
itself).
Comments
Post a Comment