What do you call a member which is not a function?

class A {
     getX() { return X_; }     // This is a member function
     int X_;                   // What is this ?
}


I would tend to refer to X_ as a member variable of class A, just as I would refer to getX() as a member function.  But, I don't see that term used much and I wonder if a better term exists.  

Thanks,
  Ken
klopterAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
>> would tend to refer to X_ as a member variable of class
>>A, just as I would refer to getX() as a member function

That's exactly the terminology that is used. "Member variable" and "member function" are the correct terms, the latter can also be called a "method".
0
 
jonninCommented:
sometimes its called a data member in books etc...
0
 
klopterAuthor Commented:
Thanks

PS to jonin.  Your answer was helpful also.
0
All Courses

From novice to tech pro — start learning today.