+ 1

What's the best practices of changing a property of a class from another class?

I used to declare them public static but this makes it accessible from anywhere

2nd May 2020, 4:00 PM
Habib Mhamadi
Habib Mhamadi - avatar
1 Respuesta
+ 2
One way is to create member functions which do the required changes to the data members(also known as mutator function). Or if you want them to be accessible in one specific class only then declare them as *protected* and let the other class inherit the original class.
2nd May 2020, 4:10 PM
Arsenic
Arsenic - avatar