+ 1
Given "MyClass obj = new MyClass;". What is stored in obj?(in C++)
In Java, the statement, “MyClass obj = new MyClass;”, means that obj stores the address of class. Is it remained the same in C++?
1 ответ
+ 2
Yes, it's roughly the same in C++ as in Java. "obj" is a *pointer* to an object/instance, meaning it contains the memory address of the place in memory that actually stores the contents of the object.