Visitor Pattern in C++ 11
First: you leak memory. Terribly. Never use new unless you know what you are doing. Use smart pointers, or in this case just objects on the stack.

The visitor pattern is meant for separating algorithms from an object structure. There is no object structure / composition / hierarchy in your code, so there is no use for the visitor pattern.

Following your example, there should be a Cart class with an accept method, that iteratively calls accept for all elements in the cart.

Also the visitor pattern is supposed to prepare for unknown algorithms operating on data structures that should not know about the algorithms. So it does not make sense to use a return value here. If you want to accumulate a prize here, you would have to do it in the state of the visitor.

Also: Use consistent spacing between type&amp; variable etc. Use consistent capitalization of methods (visit). Avoid redundant newlines.