I think they can be useful in singlton classes.

Sanju
:)



On Tue, Aug 23, 2011 at 3:32 AM, sachin sabbarwal
<[email protected]>wrote:

> i can't come up with benefits...
> but a potential use is here
> class c1
> {
> private:
>     c1()
>      {
>          }
>
> public:
> static c1* makeobject(accept credentials)
> {
>
> //check for privileges
> //if requester is privileged then make an object.(check credentials)
> //make an object by calling constructor explicitly
>
> return object;
>
>
> }
>
>
>
> };
>
>
> int main()
> {
> c1 *obj1;
>
> obj1 = c1::makeobject(my credentials);
>
>
>
>
> }
>
> //as constructor is private , we can't make an object directly. we'll let
> the class decide who can make an object of it.
> // if the class finds the requester privileged then it would let it create
> an object otherwise give error.
>
> correct me if i'm wrong, or tell me if you need more explanation.
>
>
> On Mon, Aug 22, 2011 at 9:42 AM, Decipher <[email protected]> wrote:
>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/TSCBDch6GdYJ.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to