Compiled fine in gcc. With parantheses that is... On Monday 24 Oct 2011 12:09:15 PM Praseed Pai wrote: > Hello aravind , > > I tried to compile the program using Visual C++ 64 bit edition and I > could not compile the original program . I tried your suggestion of putting > extra parenthesis , still it did not compile. > > > Did it get compiled with GCC ? > > > @All > > sizeof is a compile time unary operator. It does not have any effect at > the run time. The class written here > > do not have any instance variable. > > > What will be the size of a class with no instance variable ? ( I will put a > follow up question after this ) This was a favorite interview question of > 1990s ! > > > > regards > Praseed Pai > > > > ________________________________ > From: aravind vijayan <[email protected]> > To: [email protected] > Sent: Monday, October 24, 2011 7:09 PM > Subject: [ILUG-Cochin.org] CPP constructor... > > > HI, > Let me post a replay for a small discussion on last meeting: > > # include <iostream> > > using std::cout; > > class abc > { > public: > abc(){cout<<"In abc";} > }; > class xyz > { > public: > xyz(abc x) > {cout<<"In xyz";} > void show(){cout<<"In show";} > }; > int main() > { > xyz obj(abc()); > obj.show(); > return 0; > } > > > here we declaring a function via:xyz obj(abc()); > > you can find it your self by using sizeof operator... > > to make obj an object you will have to add () > > as: > > xyz obj((abc())); > > it will treated as object creation... > > > > > > Registered Linux user #545296 > > _______________________________________________ > Indian Libre User Group Cochin Mailing List > http://www.ilug-cochin.org/mailing-list/ > http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org > #[email protected] -- Fayaz Yusuf Khan Cloud developer and designer Dexetra SS, Kochi, India fayaz.yusuf.khan_AT_gmail_DOT_com fayaz_AT_dexetra_DOT_com +91-9746-830-823
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Indian Libre User Group Cochin Mailing List http://www.ilug-cochin.org/mailing-list/ http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org #[email protected]
