![]() |
which relationship between private constructor and derivation class
which relationship between private constructor and derivation class that derivation is not possible
(meaning constructor implements the actions required to initialize an instance) mean - stop create instance ok, but derive class ? |
Re: which relationship between private constructor and derivation class
I could not get what you are looking for?
|
Re: which relationship between private constructor and derivation class
thank for time,so
at few place i see that private constructors in class, arrest 1) create instances of the class 2) for other class to derive from the class i can't see logic for the second point ************************************************** ********** microsoft -c# language specifications-page 215 When a class declares only private constructors it is not possible for other classes to derive from the class or create instances of the class (an exception being classes nested within the class). Private constructors are commonly used in classes that contain only static members. For example: ************************************************** ************* |
Re: which relationship between private constructor and derivation class
Private constructor makes a class
1. singleton by exposing the instance of the object. As constructor is private you cannot create the objects but are bound to use the predefined method to get the object of the class. 2. You cannot derive a class from the class which has private constructor. |
| All times are GMT +5.5. The time now is 22:21. |