C++ Is it correct to call class member variables "attributes"?

attributes, c++, methods, terminology

Solution

Define "correct".

Referring to data members and member functions as "attributes/properties" and "methods", respectively, is common practice - it's the general OO wording. ("attributes" are used in C++ for something else, though, so this may very well be a source of confusion.)

The C++ standard, however, does not use these terms (apart from attributes of course, as explained above). If you don't want to risk anything and always be correct, use "data members" and "member functions".

But if you only want to explain C++ to a Java programmer, you may get away with "property" and "method" in the beginning.

Problem

Can someone please disambiguate class attributes and methods for C++? I was under the impression that attribute means any member variable, and method means any member function. Thanks

Original source

Related problems