[algogeeks] Re: interesting c++ questions
On Aug 3, 8:42 am, Raj N rajn...@gmail.com wrote: 1) Can a constructor call another constructor to initialize the same object? Answer: Yes. 2) Can a struct variable be assigned to another if the structure contains an array as a field? Answer: Yes. 3) Can we pass a private member by reference to a non member function? Answer: Maybe possible in case of friend function. 4) Can the destructor be called explicitly? 5) Can copy constructor be the default constructor of a class? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@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.
[algogeeks] Re: interesting c++ questions
1) A constructor can call another constructor but not for the same object if we are talking just the precise meaning of object and not considering the raw storage as Objects. 4) Destructor can be called explicitly .This is generally used when u have used your own new operator so that objects are allocated at some absolute address and so u can not use delete operator for cleanup. On Aug 3, 8:42 pm, Raj N rajn...@gmail.com wrote: 1) Can a constructor call another constructor to initialize the same object? 2) Can a struct variable be assigned to another if the structure contains an array as a field? 3) Can we pass a private member by reference to a non member function? 4) Can the destructor be called explicitly? 5) Can copy constructor be the default constructor of a class? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@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.
Re: [algogeeks] Re: interesting c++ questions
Can a struct variable be assigned to another if the structure contains an array as a field? You can. But it will be like a shallow copy. if the structure has a pointer variables those memory need to be assigned explicitly. 3) Can we pass a private member by reference to a non member function? No we cannot, otherwise member being private is longer valid. On Wed, Aug 4, 2010 at 11:35 AM, RITESH SRIVASTAV riteshkumar...@gmail.comwrote: 1) A constructor can call another constructor but not for the same object if we are talking just the precise meaning of object and not considering the raw storage as Objects. 4) Destructor can be called explicitly .This is generally used when u have used your own new operator so that objects are allocated at some absolute address and so u can not use delete operator for cleanup. On Aug 3, 8:42 pm, Raj N rajn...@gmail.com wrote: 1) Can a constructor call another constructor to initialize the same object? 2) Can a struct variable be assigned to another if the structure contains an array as a field? 3) Can we pass a private member by reference to a non member function? 4) Can the destructor be called explicitly? 5) Can copy constructor be the default constructor of a class? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@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.
[algogeeks] Re: interesting c++ questions
1) Yes ofcourse 2) yes you can 3) yes ofcourse 4) yes 5) i dont think . May we our default constructor def not matching ;) On Aug 3, 8:42 pm, Raj N rajn...@gmail.com wrote: 1) Can a constructor call another constructor to initialize the same object? 2) Can a struct variable be assigned to another if the structure contains an array as a field? 3) Can we pass a private member by reference to a non member function? 4) Can the destructor be called explicitly? 5) Can copy constructor be the default constructor of a class? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@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.