Re: What is going on here?
From: James Dennett (jdennett_at_acm.org)
Date: 08/19/04
- Next message: Jerry Coffin: "Re: What is going on here?"
- Previous message: parv: "Re: MS Visual C++ book recommendation to tie over an experienced programmer"
- In reply to: Karl Heinz Buchegger: "Re: What is going on here?"
- Next in thread: Alwyn: "Re: What is going on here?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 18 Aug 2004 18:46:12 -0700
Karl Heinz Buchegger wrote:
> rs wrote:
>
>>I am trying to figure out what is going on with the constructor in the
>>following class.
>> What I can not figure out is why is there a colon and then the base class
>>declaration in the constructor function.
>
>
> Everything after the ':' up to the opening '{' is called the 'intializer
> list'. Its use is to specify to the compiler what initializations should
> occour. This can be: initializations of member variables or the initialization
> of the base class this class is derived from.
>
>
>>Why is there a semicolon after the inline definition { m_pMainWnd = NULL; }
>>;
>
> It's just syntactic sugar. It doesn't need to be there, but it isn't
> wrong either. As for the same reason as there is no error in
>
> // Look Ma. Lots of empty statements
>
> ;
Actually that's not legal; there's no such thing as
an empty declaration.
Similarly
namespace foo {
};
should not include the ';'. Some compilers give diagnostics
for this error.
> int main()
> {
> ;
> ;
> ;
> }
Empty statements such as those in main above, however, are fine.
-- James
- Next message: Jerry Coffin: "Re: What is going on here?"
- Previous message: parv: "Re: MS Visual C++ book recommendation to tie over an experienced programmer"
- In reply to: Karl Heinz Buchegger: "Re: What is going on here?"
- Next in thread: Alwyn: "Re: What is going on here?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|