TCanvas by pointer or value?

All of the demonstration code that I’ve seen (in, for instance, the Primer) has various objects being allocated using new, rather than being initialized by value, such as TCanvas.

Is this obligatory, to get around these variables falling out of scope when the function exits, or for another reason? Or may I use these objects by value?

Hi,

you can use TCanvas by pointer, value or, for what it matters, by reference.
Keep in mind that a canvas which goes out of scope is not displayed.

Danilo