473,320 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How do I typedef pointer to an array of MyClass ?

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

Oct 18 '06 #1
2 1487
Subhransu Sahoo wrote:
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.
Oct 18 '06 #2
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];

--

Frederick Gotham
Oct 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Richard van Wegen | last post by:
Dear All I'm hoping someone can show me the correct way to typedef a template class - i.e. something along the lines of typedef boost::shared_ptr<T> shared_ptr_multithread<T>; (syntax is...
5
by: Eitan | last post by:
Hello, I defined a class name MyClass. I would like to define an array of 4 by 8 of that class. I would like to define a pointer to the array of MyClass. I tried it with static definition:...
5
by: Cancerbero | last post by:
Hi (first, excuse me for my bad english) As I know, the semantics for typedef is: typedef A B; I think this makes B a synonym of A, where A is an existing data type. Is that right? Based...
2
by: Mehta Shailendrakumar | last post by:
Hi all, Have alook at two different declarations below: typedef unsigned char uc; typedef void (*fptr) (void); The first declaration has a left part which is a C keyword: "unsigned char"...
6
by: Eitan | last post by:
Hello, I defined a class name MyClass. I would like to define an array of 4 by 8 of that class. I would like to define a pointer to the array of MyClass. I tried it with static definition:...
14
by: yang__lee | last post by:
Hi, You all know typedef typedef struct g { int a; int b; } google;
5
by: John | last post by:
I thought I had a fairly good understanding of typedefs until I came across the following passage from C++ Primer, fourth edition by Stanley B. Lippman: "The mistake is in thinking of a typedef...
9
by: JoeC | last post by:
I have a question about advanced poiters. I know the basics of memory managment and pointers. That a pointer points to a memory location. I also have read that dynamic memory new is used for...
5
by: Immortal Nephi | last post by:
I would like to design an object using class. How can this class contain 10 member functions. Put 10 member functions into member function pointer array. One member function uses switch to call...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.