When using C ++, if there is a class:
class MyClass
{
char memory1bye;
int memory4bytes;
int another4bytes;
};
this class uses a total of 9 bytes in memory ... so if I do something like:
MyClass *t1;
This will give me a useful address for the class, but will it allocate 9 bytes? And will it call the default constructor? Or do I need to combine these 9 bytes into a class? If then I called something like:
t1 = (MyClass *)new MyClass;
would it be considered a memory leak? In other words, what happens to the old address?
source
share