For example, say I have a class Temp:
class Temp
{
public:
int function1(int foo) { return 1; }
void function2(int bar) { foobar = bar; }
The size of an object of a class is equal to the sum of the sizes of all the data members of that class. For example if I have a class
class student
{
private:
char name[20];
int rollno, admno;
float marks;
public:
float tmarks, percentage;
void getdata();
void putdata();
};
Now, if I make an object of this class, say s1, then the size of this object will be 36 bytes:
[20(name)+2(rollno)+2(admno)+4(marks)+4(tmarks)+4(percentage)]