object oriented analysis - In c++, declaring class variable as private is always good? -
in java, usually, recommended declare class variable private
. wonder c++ is, java. if is, problem though (as think), class should have get()
, set()
functions , think quite bothering. if programming habits, gonna follow it. please share opinion.
the thing talking called encapsulation. now, term, should able find proper definitions should able find reasons use. once gained understanding of reasons encapsulation, able weigh costs , benefits solving task have , decide whether use or not.
btw, these principles independent of programming language use, although may take different forms in different languages.
Comments
Post a Comment