Please take this query as a question of curiosity.
I just want to know that is there any limitation in the number of members a class can have in c++. Hope there will be some maximum allowed number since everything will be finite in a language I guess.
That value is defined by each implementation. The C++ standard recommends some minimum supported quantities in Annex B:
— Data members in a single class [16 384].
[...]
— Direct and indirect base classes [16 384].
— Direct base classes for a single class [1 024].
— Members declared in a single class [4 096].
— Final overriding virtual functions in a class, accessible or not [16 384].
— Direct and indirect virtual bases of a class [1 024].
— Static members of a class [1 024].
The minimum for "members declared in a single class" is less than the one for "data members in a single class" because classes can inherit data members from their bases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With