current position:Home>What does the class name + [number] mean? Can all classes be used in this way?

What does the class name + [number] mean? Can all classes be used in this way?

2022-02-03 02:03:43 CSDN Q & A

img




Refer to the answer 1:

Classes and int Something like that , It's all a data type , The difference lies in int Is a system defined type , A class is a type defined by the programmer . As mentioned in the question " Class name [ Numbers ]" Is the array definition method , It and int[ Numbers ] The same principle , It can be seen as follows :int *pnarrData = new int[4]; Will define 4 An integer array of length and dynamically allocate memory , Put the int It also means the same to change to class , It's just that the type of data has changed .




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030203417379.html

Random recommended