http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.4
Also read these two links..they are very informative and a must read for people understanding virtualism. http://www.gotw.ca/publications/mill18.htm http://drdobbs.com/cpp/184403760 -sarvesh On Tue, Aug 23, 2011 at 4:11 PM, Sanjay Rajpal <srn...@gmail.com> wrote: > I think they can be useful in singlton classes. > > > Sanju > :) > > > > On Tue, Aug 23, 2011 at 3:32 AM, sachin sabbarwal < > algowithsac...@gmail.com> 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 <ankurseth...@gmail.com> 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 algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> 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 algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> 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 algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.