I want to know the detail description on the size of a class. I want to know if there is only data members & member function without any virtual keyword then why the cla
Because the class's functions are not saved inside the object itself. Think of it in terms of C programming, every function of class A takes one secret parameter, the this pointer, so in actuality they are just functions with one extra parameter.
For example imagine it like this:
int display(A* thisptr)
{
//do something
printf("%d",thisptr->a);
return;
}
So the display function is saved as just a simple function with one extra parameter. The name though is mangled depending on the compiler.
I believe that different rules apply for virtual functions which would involve function pointers but since I am not sure maybe someone else can enlighten us on this matter.