Created
June 11, 2024 11:08
-
-
Save Caballerog/b5347c97b9ce42a8894f6920dc5da659 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
import { RecipeComponent } from "./recipe-component"; | |
export class Recipe implements RecipeComponent { | |
name: string; | |
components: RecipeComponent[] = []; | |
constructor(name: string) { | |
this.name = name; | |
} | |
addComponent(component: RecipeComponent): void { | |
this.components.push(component); | |
} | |
showDetails(): string { | |
let details = `Recipe: ${this.name}\n`; | |
this.components.forEach(component => { | |
details += ` ${component.showDetails()}\n`; | |
}); | |
return details; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment