CHAPTER 12 CLASSES

A Groovy class is a collection of data and the methods that operate on that data. Together, the data and methods of a class are used to represent some real world object from the problem domain. For example, if we are developing a banking application, we might expect to find classes to represent account objects, bank objects, and perhaps customer objects. Similarly, in a university student record system, we might require classes to represent student objects, course and module objects, as well as objects that represent programs of study.

Observe how these real-world objects may have a physical presence or may represent some well-understood conceptual entity in the application. In our examples, a student will most definitely ...

Get Groovy Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.