Skip to content

question about code chapter 2 07_lsp and 08_lsp #5

@Geert1970

Description

@Geert1970

hi,
why is fuel_capacity argument assigned to 2 properties?

class Vehicle:
def init(self, fuel_capacity: float):
self._fuel_capacity = fuel_capacity
self._fuel_level = fuel_capacity

class PowerSource(ABC):
def init(self, capacity: float):
self._capacity = capacity
self._level = capacity

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions