Class memory allocation

Say I have a class with a few member functions, and only two data members: an int* Table; and an int Size;, to store the number of elements in Table.

I'm using a copy constructor that takes in two parameters: int* table, int size. In this case, is the address that table points to the same address as the object that table is part of? And furthermore, is it possible to say table.Size? I want to compare the passed array's size to the passed size.
Last edited on
No, C/C++ is case sensitive. Table and table are two different variables.

No, you cannot do table.size, the dot accesses members and functions of a class, and table is not a class. The pointer just points to a memory location and it is up to the coder to deal with where you go from there. you can however limit the size of size
Thanks Michaela. I know it's case sensitive, I did that to show that I understand that they're two different things. I was just wondering if, in memory, an instance of a class is assigned in one contiguous block.
Topic archived. No new replies allowed.