Given the following requirements:
- We have the classes
Foundation
andData
Data
is a child class ofFoundation
- Instances of
Foundation
hold an instance ofData
Python
code:
from __future__ import annotations
class Foundation():
data: Data
def __init__(self):
self.data = Data()
class Data(Foundation):
pass
Foundation()
However, the given script exits with an RecursionError
. Why and how can I implement the three given requirements?