product apple; // creates a product named apple
apple.weight = 0;
1 2
product* apple = new product; // creates a product. Apple now points to that product
apple->weight = 0;
The two bits of code are effectively the same in that they both create an apple and set the weight to 0. Obviously the pointer syntax is a little more complicated to use. Even worse, at the end of the apple's scope, the object will still exist in memory unless manually deleted. That gives the potential for memory leaks. If you're fine with using pointers, then go with it, but unless you HAVE to use them, try to avoid them. It will make your code simpler and safer.
There's little difference between the two code segments. The first code segment displays direct access of "apple"'s data members whereas the second code segment displays indirect access of "apple"'s data members.
In addition, the second code segment incurs a memory overhead, but that's another subject in itself.