new
, and never worry about delete
. You'll have memory leaks all over the place, but one thing at a time, right?#include<header.h>
definitions, prefixing function definitions with the class name (remember to use the ClassName::
syntax). Also remember that including the header files does not mean you're including the context - you will still need to refer to it using the appropriate namespace. Note: This step will produce compilation errors, but that's probably the best way to learn and get used to the differences.boost::shared_pointer
(download and install the boost libraries). It's usage is just like a normal C++ pointer (i.e. uses newlyDealtCard->member
syntax). The reason in a nutshell is that the shared pointer mimics the Java object model - object assignment creates references instead of copies, and the object is auto-deleted when all references go out of use. 99 out of 100 times, the behavior is the same and it will save you time that you can spend on understanding other things. Once you're comfortable with how C++ represents and handles memory, you can start using other smart pointer types.Syntax:interface
s, use the keyword class
. And declare the functions pure virtual.When deriving from these 'interfaces' or other classes, use public inheritance for now. There are two other type in C++ that you can start looking up once you've become more comfortable.