H
He Shiming
Hi,
I have a question regarding memory consumption of class/object member
functions.
Say that I have:
class A {
char szAbc[16];
char* getString();
}
Then I have:
vector<A> vA;
// vA.resize(100); or populate an array in other ways.
Right there, I understand that there are multiple copies of szAbc in the
memory. But what about the getString() member function? Are there multiple
copies of getString() function code in the memory? What if I have another
vector<A> vA2. Will they share the same function code in the memory?
If not, what do I to force them to share the very same member function code
in the memory?
Thanks in advance,
I have a question regarding memory consumption of class/object member
functions.
Say that I have:
class A {
char szAbc[16];
char* getString();
}
Then I have:
vector<A> vA;
// vA.resize(100); or populate an array in other ways.
Right there, I understand that there are multiple copies of szAbc in the
memory. But what about the getString() member function? Are there multiple
copies of getString() function code in the memory? What if I have another
vector<A> vA2. Will they share the same function code in the memory?
If not, what do I to force them to share the very same member function code
in the memory?
Thanks in advance,