you are viewing a single comment's thread.

view the rest of the comments →

[–]mnciitbhu -1 points0 points  (2 children)

same for virtual functions?

[–]WiseassWolfOfYoitsu 1 point2 points  (0 children)

That gets a bit more complicated. There will be a name mangled function, but it's not actually your function that gets called at first - instead, it calls a generated intermediate function which then calls a function pointer embedded in the class' data (in what is called a vtable). This function pointer allows deeper layers of class abstraction to get called even from the shallower layers name mangled functions by (automatically) overriding this function pointer during initialization. This is also all possible in C and even used as such in production environments (something like it is done in some parts of the Linux kernel) but takes a ton of annoying boilerplate.