mirror of
https://github.com/alrayyes/wiki.git
synced 2024-12-01 15:26:23 +00:00
30 lines
382 B
Markdown
30 lines
382 B
Markdown
|
---
|
||
|
id: 097ba634-5976-437d-84c9-3bfe776df02b
|
||
|
title: abstraction
|
||
|
---
|
||
|
|
||
|
# Origin
|
||
|
|
||
|
Latin abstrahere "drawm from"
|
||
|
|
||
|
# Definition
|
||
|
|
||
|
Hide implementation details from the user. For exapmle by extending
|
||
|
classes.
|
||
|
|
||
|
# Examples
|
||
|
|
||
|
``` typescript
|
||
|
abstract class Fish {
|
||
|
swim() { return '>>>>>' }
|
||
|
}
|
||
|
|
||
|
class Shark extends Fish {
|
||
|
name: 'shark'
|
||
|
}
|
||
|
|
||
|
class Tuna extends Fish {
|
||
|
name: 'tuna'
|
||
|
}
|
||
|
```
|