From: Steve Chapel Newsgroups: comp.os.msdos.djgpp Subject: Re: construction has been delayed due to somebody's stupidity (most likely my own) Date: Sat, 24 Oct 1998 00:54:05 -0700 Organization: Utilicom, Inc. Lines: 62 Message-ID: <3631879D.FA912DF5@utilicom.com> References: <5zeY1.843$SI2 DOT 270 AT news DOT cwix DOT com> NNTP-Posting-Host: steve.utilicom.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------11FF27409D78118E7B95E4F7" X-Trace: sienna.impulse.net 909215648 19154 207.33.43.138 (24 Oct 1998 07:54:08 GMT) X-Complaints-To: abuse AT impulse DOT net NNTP-Posting-Date: 24 Oct 1998 07:54:08 GMT X-Mailer: Mozilla 4.5 [en] (Win95; U) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. --------------11FF27409D78118E7B95E4F7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Jason Glass wrote: > > hey... > > my simple question is, when i do the following (as an example): > > class MyClass { > public: > MyClass(); > protected: > int data; > }; > > void main() > { > MyClass instance(); // point of interest > } > > on the line in question, it tries to accept 'instance()' as a classname, and > it totally misses the concept that it might be trying to construct the > class. the only way i can get this to work is by declaring a class pointer > object and initializing it, then destroying it at the end manually. i have > not had this problem in other dos compilers, though i HAVE had this sample > problem with linux gcc (ooh.. big surprise.. :) > > anyways, could somebody please tell me what's going on.. thanks a bunch. > > jason glass I found that leaving the parens off, like: MyClass instance; has the desired effect of calling the default constructor. Why did you use the parens in the first place? --------------11FF27409D78118E7B95E4F7 Content-Type: text/x-vcard; charset=us-ascii; name="schapel.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Steve Chapel Content-Disposition: attachment; filename="schapel.vcf" begin:vcard n:Chapel;Steve tel;fax:(805) 964-5706 tel;work:(805) 964-5848 x227 x-mozilla-html:TRUE url:http://www.utilicom.com/ org:Utilicom, Inc. Spread Spectrum Communications adr:;;323 Love Place;Santa Barbara;CA;93117-3289;USA version:2.1 email;internet:schapel AT utilicom DOT com title:Software Engineer fn:Steve Chapel end:vcard --------------11FF27409D78118E7B95E4F7--