ctor as protected



 DEVELOP > c-Plus-Plus > ctor as protected

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "MJ"
Date: 01 Aug 2005 12:53:47 AM
Object: ctor as protected
Hi
can I define constructor as protected??
if yes than what are the implications and what is the diff bet defining
the ctor as
protected and public
Mayur
.

User: "sachin"

Title: Re: ctor as protected 01 Aug 2005 02:05:03 AM
Defining c'tor protected or private means no body can instantiate it
except the class derived from it.
public c'tor class can be instantiated from any where in your code
sachin
.
User: "BigBrian"

Title: Re: ctor as protected 01 Aug 2005 07:37:03 AM

Defining c'tor protected or private means no body can instantiate it
except the class derived from it.

Or static members of the class, or friends of the class.
-Brian
.

User: ""

Title: Re: ctor as protected 01 Aug 2005 03:15:40 AM
Public declaration of ctor allows all fuctions to acces it.If declared
private or protected it is accessible only from the class itself or
inherited classes respectively.
Private or protected calss constructors are rarely used.
one example is the implementation of singleton design patterns.
Gevadas
.

User: ""

Title: Re: ctor as protected 01 Aug 2005 03:14:13 AM
see Singleton and Factory in <<Desing patterns>> and you will
understand when need to do that
.



  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER