An easy way to generate getters and setters is to use the Source option within Eclipse Indigo.
For example, create a new file, add the following lines and select them:
int nbPeople; int nbAnimal;
Then right click.
On the menu select Source > Generate getters and setters.
On the new window, click on the right Select All, then Next and Finish.
Your getters and setters are generated for you as follows:
int getNbAnimal() const
{
return nbAnimal;
}
int getNbPeople() const
{
return nbPeople;
}
void setNbAnimal(int nbAnimal)
{
this->nbAnimal = nbAnimal;
}
void setNbPeople(int nbPeople)
{
this->nbPeople = nbPeople;
}
Thanks a lot dear Eclipse ![]()
© Badprog - I want to change the world. And I will.
Add new comment