class Member extends AnyRef
Each instance of class Member
represents an individual person, recorded by an
(imaginary) society-membership app. A member has a number of basic attributes such
as a name and a year of birth.
Once created, a Member
object is immutable; to represent changes in a person,
one should create a new instance of the class.
- Alphabetic
- By Inheritance
- Member
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Member(id: Int, name: String, yearOfBirth: Int, yearOfDeath: Option[Int])
- id
a number that uniquely identifies the member from other members of the society
- name
the member's name
- yearOfBirth
the year the member was born
- yearOfDeath
the year the member died (wrapped in an
Option
;None
if the member is alive)
Value Members
- val id: Int
- def isAlive: Boolean
Returns a boolean value indicating whether the member is alive or not.
Returns a boolean value indicating whether the member is alive or not. That is, returns
true
if the member does not have a year of death,* andfalse
if they do. - val name: String
- def toString: String
Returns a compact string description of the member.
Returns a compact string description of the member. The description of a dead person has the form
"Name(YoB-YoD)"; e.g.
"Elvis(1935-1977)". The description of a living person is the same but with no year of death; e.g.,
"Madonna(1958-)".
- Definition Classes
- Member → AnyRef → Any
- val yearOfBirth: Int
- val yearOfDeath: Option[Int]