0
When I write 'MyClass obj;' in C++, is obj a pointer or an object? Differences with Java
In java we write: MyClass obj to create the pointer and then: new MyClass(); to create the object, we use the equal sign (=) to tell the pointer to point to the newly created object. How does this work in C++? When I write: MyClass obj; Am I creating a pointer, an object or both at the same time? Can obj be null or point to another object like in Java?
1 Respuesta
0
"MyClass obj;" is in C++ an object. Pointers are marked with *. As example: *ptr This is a pointer.