Skip to content

OCP SOLID #2

@liubomyr-kozak

Description

@liubomyr-kozak

Hello,

just watch your video and have a question:
why we cant use constructor for change logger services:

Example:

class Message {
    protected Logger: Logger

    constructor (){
        this.Logger = new LoggerLog()
    }

    get logger (){
        return this.Logger
    }
}

class MessageCustom extends Message{
    constructor (){
        super();
        this.Logger = new LoggerSlung();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions