Mail Archives: djgpp/1998/10/24/02:46:31
Newsgroups: | comp.os.msdos.djgpp
|
From: | "Mike Ruskai" <thanny AT spambegone DOT home DOT com>
|
Message-ID: | <gunaalubzrpbz.f1bmi21.pminews@news.avnl1.nj.home.com>
|
References: | <5zeY1.843$SI2 DOT 270 AT news DOT cwix DOT com>
|
X-Newsreader: | PMINews 2.00.1201 For OS/2
|
Organization: | TLF
|
MIME-Version: | 1.0
|
Subject: | Re: construction has been delayed due to somebody's stupidity (most likely my own)
|
Lines: | 40
|
Date: | Sat, 24 Oct 1998 07:37:14 GMT
|
NNTP-Posting-Host: | 24.3.130.120
|
NNTP-Posting-Date: | Sat, 24 Oct 1998 00:37:14 PDT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
On Sat, 24 Oct 1998 00:47:19 -0600, 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.
Well, the first thing I have to say is that your example does not demonstrate
the problem you indicate when I try to compile it, with no less than four
compilers (IBM VisualAge C++, Borland C++, GNU GCC, and DJGPP).
I would suggest, however, that you try removing the empty parentheses.
There's no reason to have them when using the default constructor.
--
- Mike
Remove 'spambegone' to send e-mail.
- Raw text -