Unreal Engine 4.x Scripting with C++ Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it...

In the following code, we declare a simple Object class, then construct an instance of it using the new operator:

class Object 
{
Object()
{
puts( "Object constructed" );
}
~Object()
{
puts( "Object destructed" );
}
};

// Invokes constructor
Object * object = new Object();

// Invokes deconstrctor
delete object;

// resets object to a null pointer
object = 0;