-
-
Save dimitris-papadimitriou-chr/37159a1f07fc42718622ab92cdb6f0e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Product { getPrice(): number; } | |
export class ProductA implements Product { | |
private _price: number; | |
constructor(price: number) { | |
this._price = price; | |
} | |
getPrice(): number { | |
return this._price; | |
} | |
} | |
export class Packaging implements Product { | |
private _product: Product; | |
constructor(product: Product) { | |
this._product = product; | |
} | |
getPrice(): number { | |
return this._product.getPrice() + 0.5; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment