Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c++ Subject: Re: Correction to Re: Default constructor, unexpected call Summary: sowing the flame and reaping the firestorm Message-ID: <424@mole-end.UUCP> Date: 9 Aug 90 00:02:54 GMT References: <26655@pasteur.Berkeley.EDU> <643@atcmpe.atcmp.nl> <615@dlogics.COM> Organization: mole-end--private system. admin: mole-end!newtnews Lines: 96 > > My question is simple: why does the following program generate a > > call to the default constructor from class A for variable 'copd'? [ real query about something that might be a real bug, ending with ] > > class C{ > > public: > > C(){ puts("default constructor C()");} > > protected: > > A a; //switch these: bug(?) gone > > B b; // if not a bug: A::A() gone!!!! > > }; > > . . . > > C copd(defd); //suspicious A::A() class here > ^^^^ > Well, I don't know how this compiled because you don't have > anything other than a default constructor for class C. This > shouldn't have compiled! Except that copy constructors can be created by the compiler automatically, and any investigation into this matter should take them into account by declaring them private or else by declaring them public and providing them, appropriately studded with probes. It should compile (as far as I can see) and it did. Not to say that there might not be some interesting and subtle problems with it; I haven't got that compiler (which I presume to be cfront) handy, else I would check. If the original author would check out the copy constructors, I would like to hear of the results. [ A bunch of blank lines ] > I hate this stupid program And the Net should care? If you hate it, why bother to reply? Why bother to repost the whole thing? And if you are going to flame, please be right. Otherwise people like me will feel free to jump down your throat. ``And them's that don't like me can leave me alone.'' [ Another bunch of blank lines ] > This is really stupid Well, it's pretty clear that SOMETHING is at least a little stupid; I don't think that it's the original posting, however. There's something subtle going on in there. [ Yet another bunch of blank lines ] > Who wrote this junk? His name was on it, as I recall. I don't know that I can endorse the appellation `junk' for HIS work. > -- > David S. Angulo (312) 266-3134 > Datalogics Internet: dsa@dlogics.com > 441 W. Huron UUCP: ..!uunet!dlogics!dsa > Chicago, Il. 60610 FAX: (312) 266-4473 I hope that the author of the remarks was not the individual whose name appears in the signature; this wouldn't be the first case of a pirated account. The infamous Case of the Impersonation of Elizabeth Bimmler comes to mind. ``And then some deranged cat-molester begins posting about the role of contraception in the development of the ball-point pen.'' --The Hitch-Hiker's Guide To The Net -- (This man's opinions are his own.) From mole-end Mark Terribile