Given a class, what reasoning exists for either of the following two styles of code?
Style A:
class Foo {
private:
doWork();
int bar;
}
Style B:
class Foo {
private:
int bar;
doWork();
}
For me it's a tie. I like Style A because member variables feel finer and therefore more general member functions will be displayed. However, I also like style B because the member variables seem to define in OOP style what the class represents.
Are there other things to consider when choosing between these two styles?
source
share