Given the following requirements:
- We have the classes
FoundationandData Datais a child class ofFoundation- Instances of
Foundationhold 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?