Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


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

Re: Help with Compile Error :)

by "Jim Langston" <tazmaster@[EMAIL PROTECTED] > Jul 19, 2008 at 10:42 PM

"Kush" <kbubbar@[EMAIL PROTECTED]
> wrote in message 
news:151380bd-49f9-487a-8223-9d8207005eaa@[EMAIL PROTECTED]
> Hi Ben,
> Thank you for your reply.  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();

This is declaring a private function called raceEnvironmentalFactors that 
takes no parameters and returns an EnvironmentalFactors.

>        public:
>                RunProgram();
>                void Run(void);
> };
>
> If I changed it to:
> ----------------------------------------------------------------
> class RunProgram
> {
>        private:
>                RaceCoordinator raceCoordinator;  //Note the lack of
> "()"
>                EnvironmentalFactors raceEnvironmentalFactors;  //Note

This is declaring a private variable raceEnvironmentalFactors of type 
EnvironmentalFactors.

> 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.

What is raeEnvironmentalFactors supposed to be?  A function or a variable?

Without more code it is hard to understand what you are attempting.
 




 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
tan12V112 Sat Sep 6 12:52:06 CDT 2008.