Does line #2 work fine ie: no error?
Also dynamically allocating memory for an object(pointer) allocates a specific amount of memory to the object from the heap.
So after finishing using the object, you must free the memory with delete, if new was used, or delete[] if it is an array.