|
From: Graham D. <g.d...@nt...> - 2003-07-05 19:45:46
|
It's not an operator, it starts the member intialiser list. This can be
used to intialise both the base class and member variables. e.g.
class bar
{
public:
bar(int i) : barmember(i) {}
private:
int barmember;
};
class foo : public bar
{
public:
foo(int i) : bar(i), foomember(10) {}
private:
int foomember;
};
Juliano Pável Brasil Custódio wrote:
> Recently I decided to start learning C++ again. When I was taking a
> look at VC++, I've found a piece of code that I have no idea of what
> it does:
>
> aView::aView() : m_rectEllipse(0,0,2000,-1000){...}
>
> My doubt is at the single ":" operator. I thought it was used just
> when I'd like to invoke the constructor of a base class through a
> derived class. But in this case, in the part of the code I've ommited
> here, m_rectEllipse is a CRect object, member of the aView class. Is
> there another way to use the ":" operator that I missed?
>
> Juliano
>
>
|