Quantcast
Channel: Question and Answer » encapsulation
Viewing all articles
Browse latest Browse all 12

Encapsulation: Should all properties be private and protected?

$
0
0

After learning about encapsulation in OOP, I started to use only protected and private properties, share data via accessors and change properties via mutators.

Right now, I’m afraid of declaring public properties.

Is it good to keep everything private and protected or is there some cases where I need to use public properties?


Viewing all articles
Browse latest Browse all 12

Trending Articles