class MyClass{
int x;
public:
int GetX{return x;}
};
Questions:
1. If I make ten class MyClass objects, does it store ten copies of the int GetX function in memory?
2. If I make int GetX a friend function instead, how many copies does it store in memory then?
Right now, I have a class that calls a function outside of itself. It's not as clean, but doing it that way, I'm sure that that function is stored only once in memory instead of once for each instance of that class. However, I'd like to put that function and those like it into the class if it's not going to eat up more memory.