Introduction to OOP Chapter 4: Classes and Methods: next previous audio real text

Accessor (or getter) Methods

An accessor (or getter) is a method that simply returns an internal data value:

class PlayingCard {
	...
		// operations on a playing card
	public int     rank      ()           { return rankValue; }
	public Suits   suit      ()           { return suitValue; }
	...
	private int rankValue;
}

Intro OOP, Chapter 4, Slide 19