Brett McCoy wrote:
>  
>
> On Mon, Mar 15, 2010 at 8:43 PM, nimak247 <[email protected] 
> <mailto:nimak247%40yahoo.com>> wrote:
>
> > Thanks Sumant!!
> >
> > If I may ask a follow up question, how does the following line work:
> > myT test = (myT)new myT;
> >
> > It looks like it is casting the type before the 'new' operator??
> >
> > Any help would be appreciated!
>
> It is wrong. new does not require a cast. When using new with a
> struct, is uses a default constructor (just like with a class).
> Casting is totally unnecessary.
>
> -- Brett
> ----------------------------------------------------------
> "In the rhythm of music a secret is hidden;
> If I were to divulge it, it would overturn the world."
> -- Jelaleddin Rumi
>
> 
But it isn't allocating a new struct. It is allocating a pointer. I 
think the OP is confused with the declaration for the structure... I 
would expect to see something like:

typedef struct MYTYPE {
            ...
} *LPMYTYPE;

not

typedef struct {
            ...
} *MYTYPE;

Reply via email to