[LC++]Default Arguments

Mark Phillips mark at austrics.com.au
Fri May 10 11:54:05 UTC 2002


Jack Lloyd wrote:


> class Y
>    {
>    public:
>       const X* x;
>       void foo() { printf("%d\n", x->foo); }
>       Y(X* xx = new X(42)) : x(xx) {}
>    };


Not quite an answer to your question, but...

Wouldn't the above be a memory leak?  "X(42)" would not get
deleted.

Cheers,

Mark.

-- 
Dr Mark H Phillips
Research Analyst (Mathematician)

AUSTRICS - Smarter Scheduling Solutions - www.austrics.com

Level 2, 50 Pirie Street, Adelaide SA 5000, Australia
Phone +61 8 8226 9850
Fax   +61 8 8231 4821
Email mark at austrics.com.au





More information about the tuxCPProgramming mailing list