Version 3 (modified by Charles, 12 years ago) |
---|
Properties
Introduction
Properties provide a way to get and set the values that characterize an object. A business application could have a Customer class with properties .name, .address and .id. A video game could have a GameObject class with properties .position, .velocity and .health.
Syntax
to-do
Compared to Methods
- Methods can take parameters.
- In practice, methods are not systematically enumerated and invoked.
- Methods may perform substantial calculations and/or I/O.
- Methods are about actions and computations; properties are about inspection or characteristics.