course update of 2023-11-30 09:36:57
This commit is contained in:
66
Prog/OOP.md
Normal file
66
Prog/OOP.md
Normal file
@ -0,0 +1,66 @@
|
||||
# Object Oriented Programming
|
||||
|
||||
<img src="https://i.imgur.com/qPsUYyd.jpg" alt="meme" style="zoom:50%;" />
|
||||
|
||||
## Introduction
|
||||
|
||||
- A programming paradigm
|
||||
- Allows:
|
||||
- Model objects
|
||||
- Make objects interact with each other
|
||||
- Objcts refer to complex variables
|
||||
|
||||
## Benefits and motivation
|
||||
|
||||
- Modularity
|
||||
- Abstraction
|
||||
- Productivity and reusability
|
||||
- Security and encapsulation
|
||||
|
||||
## Concrete example
|
||||
|
||||
- When we develop a game with cars inside
|
||||
- We develop the car one time and all other games can re-use the base of the car that we created
|
||||
- We have access to characteristics
|
||||
- Model
|
||||
- Color
|
||||
- Fuel type
|
||||
- ...
|
||||
- We also have the behavior of the car
|
||||
- Start
|
||||
- Accelerate
|
||||
- Stop
|
||||
|
||||
## Object
|
||||
|
||||
- Data part: object characteristcs
|
||||
- Attributes
|
||||
- Properties
|
||||
- Fields
|
||||
- ...
|
||||
- Code part = oject behavior
|
||||
- Methods
|
||||
- Procedure
|
||||
|
||||
## Class
|
||||
|
||||
- Object = classs instance
|
||||
- Class
|
||||
- New data type
|
||||
- Collection of objects
|
||||
- Figuratively
|
||||
- Class = mold
|
||||
- Object = cake
|
||||
- Class at compilation VS object at runtime
|
||||
|
||||
```csharp
|
||||
public class MyFirstClass {
|
||||
public MyFirstClass() {} //constructor
|
||||
}
|
||||
MyFirstClass c = new MyFirstClass(); //new object
|
||||
```
|
||||
|
||||
## Modelization
|
||||
|
||||
- First mandatory step
|
||||
-
|
Reference in New Issue
Block a user