i already told you that i am a novice in C++ but i
doubled checked before i replied to your reply. Pls
try again and reply back.

I dont know about other compilers but your code will
not work with ANSI C++  compiler.

--- Shyan Lam <[EMAIL PROTECTED]> wrote:

> Please make sure you're sending the reply to the
> group by checking the To
> field.  It should be:
> [EMAIL PROTECTED]
> 
> I have asked the group owner to fix this.
> 
> See reply embedded...
> 
> > -----Original Message-----
> > From: viswatej nalubolu
> [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, December 16, 2004 1:56 AM
> > To: Shyan Lam
> > Subject: RE: (PT) I need the solution for this
> > 
> > what you said is correct but you have to overload
> the
> > constructor - say pass some dummy argument and
> call it
> > accordingly.
> 
> No you don't need argument.  You simply need to
> supply a default constructor
> 
> 
> > just try it with ANSI C++ compiler and notice that
> if
> > you dont overload the constructor, you wont be
> getting
> > the result.
> 
> One single default constructor will do it.  
> 
> 
> > #include <iostream.h>
> > class newone
> > {
> >   public:
> >          newone (int i);
>                    ^^^^^
>    newone(void);
> 
> >          ~newone ();
> > };
> > 
> > newone::newone (int i)
>                 ^^^^^^^^
>   newone::newone(void)
> > {
> >   cout << "Constructor called\n";
> > }
> > newone::~newone ()
> > {
> >   cout << "Destructor called\n";
> > }
> > 
> > /*Now initialize the global object*/
> > 
> > newone object(10);
>               ^^^^^^
>    newone object;
> 
> > /*END*/
> > Just try to think about the reason behind such a
> > behaviour. 
> 
> Which behavior you're referring to? 
> 
> 
> > I am a novice in C++ but probably a default
> > constructor (with no args) is being called in this
> > scenario. 
> 
> Once you overload constructor, the compiler will not
> generate default
> constructor for you.
> 
> 
> > pls comment on this issue and correct me if
> > i am wrong.
> 
> A user-defined default constructor would be
> sufficient for this interview
> question.
> 
> The interviewer is testing the candidate the
> following concept:
> "Global object is created before main() and destroy
> after main()".
> 
> HTH
> Shyan
> 
> 
> 
> 



                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe : [EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To reply to this message, go to:
    
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4533
    Please do not reply to this message via email. More information here:
    http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> To visit your group on the web, go to:  
    http://groups.yahoo.com/group/Programmers-Town/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to