Talk About Network

Google





Programming > C - C++ Learning > Re: Help with C...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 9 Topic 4210 of 4400
Post > Topic >>

Re: Help with Compile Error :)

by ike@[EMAIL PROTECTED] (Ike Naar) Jul 20, 2008 at 06:50 AM

In article
<151380bd-49f9-487a-8223-9d8207005eaa@[EMAIL PROTECTED]
>,
Kush  <kbubbar@[EMAIL PROTECTED]
> wrote:
>I played with the code further and
>determined that the error was due to the fact that within the
>definition of the RunProgram class I define two member objects: the
>first being raceCoordinator of type RaceCoordinator and the second,
>raceEnvironmentalFactors of type EnvironmentalFactors.  Apparently,
>for some reason I am not aware of, if I remove the brackets after the
>definition, the code compiled.
>
>So I had the below code originally which did not compile.
>----------------------------------------------------------------
>class RunProgram
>{
>        private:
>                RaceCoordinator raceCoordinator();
>                EnvironmentalFactors raceEnvironmentalFactors();
>        public:
>                RunProgram();
>                void Run(void);
>};
>
>If I changed it to:
>----------------------------------------------------------------
>class RunProgram
>{
>        private:
>                RaceCoordinator raceCoordinator;  //Note the lack of
>"()"
>                EnvironmentalFactors raceEnvironmentalFactors;  //Note
>the lack of "()"
>        public:
>                RunProgram();
>                void Run(void);
>};
>
>I don't quite understand why this is, but it worked.  I was under the
>impression that if you called the default constructor you still needed
>the "()".  I believe this is the case in C#.NET, which may have
>confused me.

This is explained in the FAQ:
http://www.para****ft.com/c++-faq-lite/ctors.html#faq-10.2

Regards,
Ike
 




 9 Posts in Topic:
Help with Compile Error :)
Kush <kbubbar@[EMAIL P  2008-07-19 11:10:17 
Re: Help with Compile Error :)
Ben Cottrell <bench@[E  2008-07-19 20:26:14 
Re: Help with Compile Error :)
Kush <kbubbar@[EMAIL P  2008-07-19 20:37:03 
Re: Help with Compile Error :)
"Jim Langston"   2008-07-19 22:42:11 
Re: Help with Compile Error :)
ike@[EMAIL PROTECTED] (I  2008-07-20 06:50:17 
Re: Help with Compile Error :)
Kush <kbubbar@[EMAIL P  2008-07-20 05:32:41 
Re: Help with Compile Error :)
Kush <kbubbar@[EMAIL P  2008-07-20 05:39:27 
Re: Help with Compile Error :)
ike@[EMAIL PROTECTED] (I  2008-07-20 15:08:22 
Re: Help with Compile Error :)
Francis Glassborow <fr  2008-07-22 14:07:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 5:40:37 PST 2009.