Re: help with constructor
- From: "Daniel" <falsename@xxxxxxxxxxxxxxx>
- Date: Thu, 18 Dec 2008 14:07:57 -0600
What if I want to call a constructor for another member variable, would I separate it from the other constructor with a comma or another colon?
--
Daniel
"Brian Muth" <bmuth@xxxxxxxx> wrote in message news:e6sqbeKYJHA.5108@xxxxxxxxxxxxxxxxxxxxxxx
It is calling the constructor for the m_psz member variable, and passing a pointer to some allocated memory as a value..
Note I can do this for other built-in variable types as well:
int i1= 5;
int i2 = int (5);
int i3 (5);
all do pretty much the same thing, in terms of declaring and assigning a value to a variable.
"Daniel" <falsename@xxxxxxxxxxxxxxx> wrote in message news:0815863E-AF25-44AE-9005-899C3E9CEE74@xxxxxxxxxxxxxxxxWhat does the line do after the last colon below?
// faststring.h
class FastString {
char *m_psz
public:
FastString(const char *psz);
// faststring.cpp
FastString::FastString(const char *psz)
: m_psz(new char[strlen(psz) + 1]) {
}
--
Daniel
- Follow-Ups:
- Re: help with constructor
- From: Brian Muth
- Re: help with constructor
- References:
- help with constructor
- From: Daniel
- Re: help with constructor
- From: Brian Muth
- help with constructor
- Prev by Date: Re: VS2008 && /clr && boost::thread == error LNK2022
- Next by Date: Re: help with constructor
- Previous by thread: Re: help with constructor
- Next by thread: Re: help with constructor
- Index(es):
Relevant Pages
|