Created
July 29, 2020 21:46
-
-
Save sudomaxime/16dc7372765422e1fcd3fd6e9932cf00 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 GoodBoyEvaluator from "./GoodBoyEvaluator"; | |
class Dog { | |
private gotCookie: boolean; | |
public name: string; | |
constructor (name) { | |
this.name = name; | |
} | |
giveCookies (): void { | |
const boy = new GoodBoyEvaluator(this); | |
if (boy.worthyOfCookies) { | |
console.log(`${this.name}, got cookies !`) | |
this.gotCookies = true; | |
} | |
} | |
} | |
var dogs: Array<Dogs> = [ | |
new Dog("Philibert"), | |
new Dog("Clifford") | |
]; | |
dogs.forEach(dog => dog.giveCookies()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment