Re: Usage of pointer to object under construction

From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 01/11/05


Date: Tue, 11 Jan 2005 12:04:57 -0500

Dave wrote:
> In the code below, I use a pointer to an object under construction. Is the
> usage below legal? I have come across similar code at work. It compiles,
> but I'm not sure it's really legal...
>
> Thanks,
> Dave
>
> struct D;
>
> struct B
> {
> B(D *);
> };
>
> struct D: B
> {
> D(): B(this) {}
> };

There is no _usage_ here. To show _usage_ you need to post the _body_ of
the B's constructor.

Victor



Relevant Pages