SOLID-Principles-Examples-using-Typescript icon indicating copy to clipboard operation
SOLID-Principles-Examples-using-Typescript copied to clipboard

OCP SOLID

Open liubomyr-kozak opened this issue 3 years ago • 0 comments

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();
    }
}

liubomyr-kozak avatar Jun 29 '22 09:06 liubomyr-kozak