Pointer to a pointer to an array?

Help me understand this line of code.

ClassType** pp = new (ClassType*)[2];

Is saying this is a pointer to a pointer that points to a dynamically allocated array of object of type ClassType?

Is that set of parentheses a typecaster or an initializer, calling the constructor of the class?

Thanks in advance :)
Last edited on
That code does not compile.
Alright. This is actually taken from an assignment, in which i have to draw a "data diagram" based on that line of code. It's possible it's a trick question, but I doubt it.

So technically, you couldn't draw a diagram based on that line of code?

Edit: Sorry, the actual line of code is ClassType** pp = new (ClassType*)[2]; but you are still right, it doesn't compile. Could you explain why though? Is it because you're trying to initialize ClassType** with ClassType*, and they are different?
Last edited on
Topic archived. No new replies allowed.