Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: C++
Expertise: All
May 15, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

How Many Member Functions Can a Class Contain?

The C++ standard doesn't specify the maximal number of member functions that a class can have. However, it recommends that it be 4096. Normally, classes don't have more than 15-25 member functions so you never care about this upper limit. However, people who migrate from C to C++ sometimes group a bunch of legacy C functions under a single class. In a recently posted message on one of the C++ newsgroups, a reader complained that his compiler crashed because he tried to compile a class with 2500 (!) member functions in it. Seemingly, this number doesn't exceed the upper limit recommended in the C++ standard. The problem, however, is that debuggers need to store debugging information on every class member. When the number of members is so high, the compiler crashes.
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date