compiler construction - c++ sizeof() of a class with functions -


i have c++ question. wrote following class:

class c {     int f(int x, int y){ return x; } }; 

the sizeof() of class c returns "1". i don't understand why returns 1.

trying understand better going on, added function:

class c {      int f(int x, int y){ return x; }      int g(int x, int y){ return x; } }; 

now following got me confused! sizeof(c) still 1 (!?!?!?!). guess functions doesn't change size of class, why??? , why size 1 ? , compiler specific ?

thanks! :-)

the class contains no data members, it's empty. standard demands every class have @ least size 1, that's get. (member functions aren't physically "inside" class, they're free functions hidden argument , namespace , access control.)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -