Koki's Web Chronicles
Hello! Guest
Login
SignUp
Flashcard App
📁 All Cards
1st Box
1
2nd Box
13
3rd Box
0
4th Box
24
5th Box
0
Cerate New Card
Edit Card
Question
Answer
Text
```python class Car: pass class Engine: pass # CaeクラスとEngineクラスは関連している car = Car() engine = Engine() car.engine = engine # 所持 (Aggregation) class Computer: def __init__(self): self.cpu = CPU() class CPU: pass # ComputerクラスがCPUクラスを部分として所有 computer = Computer() # Computerが破壊されると同時にcpuも破棄される # 疎な依存(Dependency) class ReportGenerator: def generate_report(self, data_source): pass # ReportGeneratorクラスはDataFetcherクラスに依存している class DataFetcher: pass # 汎化(Generalization) class Animal: def speak(self): pass class Dog(Animal): def speak(self): return "Woof" # DogクラスはAnimalクラスを汎化している # 実現(Realization) class Shape: def draw(self): pass class Circle(Shape): def draw(self): pass # CircleクラスはShapeクラスを実現している。 ```
Type MarkDown
Box
1
2
3
4
5
Cnacel