In this class, I have the constructor take in 4 parameters. And the values are initialized appropriately. Set int imageid to mImageId, etc..
What is then the purpose of the sequence of getters/setters if the member variables are initialized by the parameters?
From what I've read. getters/setters for every field or member variable essentially makes the class "public". Or is the purpose of getters/setters to broadcast some "intent" to another class?
public class Page {
private int mImageId;
private String mText;
private Choice mChoice1;
private Choice mChoice2;
public Page(int imageId, String text, Choice choice1, Choice choice2 ){
mImageId = imageId;
mText = text;
mChoice1 = choice1;
mChoice2 = choice2;
}
// start of getters/setters
public int getImageId(){
return mImageId;
}
public void setImageId(int id){
mImageId = id;
}
public String getText() {
return mText;
}
public void setText(String text) {
mText = text;
}
public Choice getChoice1() {
return mChoice1;
}
public void setChoice1(Choice choice1) {
mChoice1 = choice1;
}// Choice 1
public Choice getChoice2() {
return mChoice2;
}
public void setChoice2(Choice choice2) {
mChoice2 = choice2;
}// Choice 2