Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Meet and Greet (http://www.go4expert.com/community/meet-and-greet/)
-   -   which relationship between private constructor and derivation class (http://www.go4expert.com/community/relationship-private-constructor-t3226/)

gorangk 2Mar2007 16:01

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 ?

shabbir 2Mar2007 16:46

Re: which relationship between private constructor and derivation class
 
I could not get what you are looking for?

gorangk 2Mar2007 19:40

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:
************************************************** *************

shabbir 5Mar2007 09:22

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 17:28.