private String gg;
public void setgg(String gg)
{
this.gg = gg;
}
public String getgg()
{
return gg;
}
Considering the above code, setter and getters are use to act on the private members of a class.
question1. If setter takes one more parameter it will not be a setter I guess ?
question2. How they are different for normal public member functions setting the values of private data members ?
I know we can implement validation in setters to for reusable code and throw exceptions but still not able to understand the real purpose
question1. If setter takes one more parameter it will not be a setter I guess ?
It would be setting the value, But it wouldn't be the standard setter method that many framework is looking for to set the value
question2. How they are different for normal public member functions setting the values of private data members ?
They are normal public member methods with standard naming convention
See