Group: comp.lang.c++
From: Ian Collins
Date: Monday, February 18, 2008 1:27 AM
Subject: Re: Macro, Polymorphism

D. Susman wrote:
> Hi,
>
> I wonder if there is a way to introduce polymorphic parameters to a
> macro. What I'm trying to say is: Say, I have a macro X taking
> argument of type A*. Let there be a B class deriving from class A. Can
> I pass a B to the macro as a pointer to A?
>
Macros lack any form of type system, they just perform substitutions.

> (One might say, "use templates anyway". I am applying a memory pool
> mechanism and wrapping new and delete with macros New and Delete
> correspondingly)
>
OK then, why not provide your own new and delete operators?

--
Ian Collins.

Safety Articles | Usenet Groups | Usenet News | Bluegrass