I had a quiz at school and there was this question that I wasn’t sure if I answered correctly. I could not find the answer in the book so I just wanted to ask you.
Point* array[10];
How many instances of class Point are created when the above code is called?
I answered none because it only creates space for 10 instances, but doesn’t create any. Then my friend said it was just one because when the compiler sees Point* it just creates one instance as a base.
It creates no
Points.What it does is creates an array of ten pointers that can point to
Pointobjects (it doesn’t create space for ten instances). The pointers in the array are uninitialized, though, and noPointobjects are actually created.