c++ - What's the difference between using a.var and a.var() -
just example
class a{ public: int a; }; int main(){ test; int b = test.a; int c = test.a(); } my question when accessing member variable of class, there difference between using test.a , test.a()?
here test.a() call a function whereas test.a access object's public variable, both different things.
also, syntax incorrect should class instead of class.
Comments
Post a Comment