Best Practices
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I would like to know if Its a good idea to declare member variables in the base abstract class and provide its basic getter and setter method implementation in the abstract class ??
I also wanted to know, when it would be an ideal situation to declare a member variable as Protected.
Thanks,
Jilesh
I also wanted to know, when it would be an ideal situation to declare a member variable as Protected.
Thanks,
Jilesh
-Jilesh
Universe and Knowledge has no bounderies
posted 15 years ago
Why not? After all, the abstract class allows you to have concrete implementation and not only abstract methods
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I would like to know if Its a good idea to declare member variables in the base abstract class and provide its basic getter and setter method implementation in the abstract class ??
Why not? After all, the abstract class allows you to have concrete implementation and not only abstract methods

SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thanks,
How about the usage of Protected..
How about the usage of Protected..
-Jilesh
Universe and Knowledge has no bounderies
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
CarefullyChooseOneForum. Moving to Java beginners.
apigee, a better way to API!
posted 15 years ago
If you plan on using getters and setters, I would use private access for all variables.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Jilesh Lakhani wrote:Thanks,
How about the usage of Protected..
If you plan on using getters and setters, I would use private access for all variables.
"If the facts don't fit the theory, get new facts" --Albert Einstein
posted 15 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
It's not Protected but protected. I would agree with Hunter McMillan: all fields ought to have private access until proven otherwise. Avoid other access types for fields (except public static final) as far as possible.
| I will open the floodgates of his own worst nightmare! All in a tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |











