You are on page 1of 16

OOP

Properties & Methods

J. LLEVADO
UML: Class Diagram Example
Person Name

- name: String
- age: int
- gender: String Attributes
- address: String

+ setName(name): void
+ getAge() : int Methods
+ getAddress() : String
+ isMale(): boolean
Properties
 Also called attributes
 Features that characterize classes
 Bound to the class
Defining properties
methods
 Behavior of a class
 Bound to the class
 Has access to properties
Defining methods
Method parameters
 Variable defined in method
declaration
 A Pre-requisite value before using a
method
Method parameters
Method return types
Expected data type to be
returned by the method
Method return types
Access modifiers
 Keywords use to control visibility
of fields, methods, and constructor
Access modifiers
 Public – anywhere
 Private – within the class
 Protected – through inheritance
Using access modifiers
Accessor & mutator method
 Accessor
– get the property state
 Mutator
– change the property state
Accessor & mutator method

Mutator

Accessor
thanks!
For questions you may contact me
through our FaceBook group or
email.

You might also like