How do I typedef pointer to an array of MyClass ?

S

Subhransu Sahoo

Hi All,

How do I typedef pointer to an array of MyClass ??

e.g. CMyClass (*x)[] -> i want to write as PtrToMyClassArray x.

Regards,
Sahoo
 
S

Sumit Rajan

Subhransu said:
Hi All,

How do I typedef pointer to an array of MyClass ??

e.g. CMyClass (*x)[] -> i want to write as PtrToMyClassArray x.

Not sure if I understand your question correctly. Do you mean that if
you have a class A, you want a typedef for an array of such A's like:

typedef A AArray[4];
AArray arrrr;


Or do you want a typedef to a pointer to a such as:

typedef A* PtrToA;
PtrToA ptrA = new A[4];
delete[] ptrA;

Regards,
Sumit.
 
F

Frederick Gotham

Subhransu Sahoo posted:
Hi All,

How do I typedef pointer to an array of MyClass ??


I'd advise against it, but anywho:

std::size_t const len = 8;

typedef MyClass (*BadType)[len];
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top