Answer the question
In order to leave comments, you need to log in
How are the elements of an array of class objects arranged in memory?
How are arrays of class objects arranged? In theory, moving through the array occurs when the pointer is shifted by a certain number of bytes, but a class object can contain both a vector and a template can be, which means that different elements of the array (class objects) can occupy a different number of bytes in memory. How is this problem solved in c++?
Answer the question
In order to leave comments, you need to log in
Objects in C++ have a constant size, known at compile time, equal to sizeof( instance )
Statement:
a class object can also contain a vector ... which means that different array elements (class objects) can occupy a different number of bytes in memory.
[class object] and template can be ... which means that different array elements (class objects) can occupy a different number of bytes in memory.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question