c++ sizeof() of a class with functions

The class contains no data members, so it’s empty. The standard demands that every class have at least size 1, so that’s what you get. (Member functions aren’t physically “inside” a class, they’re really just free functions with a hidden argument and a namespace and access control.)

Leave a Comment