Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

class

Application Area

Specification

Full Example

// [WIP] Suggest Changes!
// TODO: need to sketch out how to do relations nicely

// Classes
Person {
	- name: String
	- age: int
	---
	+ drive()
	+ ride()
}

// Abstract Class
$ Vehicle {
	# speed: int
	- color: String = "black"
	~ distance: float
	---
	+ accelerate()
	$ brake()
}

// Interface
$ Insurable {
	---
	$ getInsuranceRate(): float
	$ isClaimEligible(): boolean
}

// extends and implements
Car: Vehicle,Insurable  {
	- doors: int
	---
	+ brake()
	+ getInsuranceRate(): float
	+ isClaimEligible(): boolean
}
Bike: Vehicle  {
	- gears: int
	---
	+ brake()
}
// [WIP] Suggest Changes!
// TODO: need to sketch out how to do relations nicely

// Classes
Person {
	- name: String
	- age: int
	---
	+ drive()
	+ ride()
}

// Abstract Class
$ Vehicle {
	# speed: int
	- color: String = "black"
	~ distance: float
	---
	+ accelerate()
	$ brake()
}

// Interface
$ Insurable {
	---
	$ getInsuranceRate(): float
	$ isClaimEligible(): boolean
}

// extends and implements
Car: Vehicle,Insurable  {
	- doors: int
	---
	+ brake()
	+ getInsuranceRate(): float
	+ isClaimEligible(): boolean
}
Bike: Vehicle  {
	- gears: int
	---
	+ brake()
}