Constructor syntax
From: Ben R. (BenR_at_discussions.microsoft.com)
Date: 11/01/04
- Next message: Victor Bazarov: "Re: Constructor syntax"
- Previous message: scallejo: "128 Return Code"
- Next in thread: Victor Bazarov: "Re: Constructor syntax"
- Reply: Victor Bazarov: "Re: Constructor syntax"
- Reply: Jeff F: "Re: Constructor syntax"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 1 Nov 2004 12:37:02 -0800
Could someone explain to me this odd syntax for a class constructor
definition header where after the definition, there's a ":" and calls to what
look like functions but are just variables? Example:
class myclass{
myclass(int howmany) : somevar(5)
{
// constructor goes here
};
I think I reproduced it accurately. I see this syntax every now and then and
would just like a better understanding of it. Does it just assign the value 5
to somevar? If so, what's the advantage here? Any clarification would be
appreciated. Thanks...
-Ben
- Next message: Victor Bazarov: "Re: Constructor syntax"
- Previous message: scallejo: "128 Return Code"
- Next in thread: Victor Bazarov: "Re: Constructor syntax"
- Reply: Victor Bazarov: "Re: Constructor syntax"
- Reply: Jeff F: "Re: Constructor syntax"
- Messages sorted by: [ date ] [ thread ]