It's exactly the same as with normal types.
Class a; //stack. Usage: a.somethingInsideOfTheObject
Class *a = new Class(); //heap. Usage: a->somethingInsideOfTheObject
Note that if the class itself is allocating something on the heap, that part will always be on the heap, for example:
class MyClass
{
public:
MyClass()
{
a = new int();
}
private:
int * a;
};
void foo()
{
MyClass bar;
}
in this case the bar variable will be allocated on the stack, but the a inside of it will be allocated on the heap.