Created
October 21, 2024 13:40
-
-
Save ecesar88/3b66f4d54c06a1caa99b6e9c79536402 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
enum EXCHANGE_RATE_REGIMES { | |
FLOATING_EXCHANGE = "CÂMBIO FLUTUANTE", | |
} | |
class Person { | |
constructor(age: number, name: string) { | |
this.age = age; | |
this.name = name; | |
} | |
public age: number; | |
public name: string; | |
} | |
class Girl extends Person { | |
constructor(beauty: { beauty: number }) { | |
super(24, "Her"); | |
this.beauty = beauty; | |
} | |
public beauty: { beauty: number }; | |
public getExchangeRateRegime() { | |
return EXCHANGE_RATE_REGIMES.FLOATING_EXCHANGE; | |
} | |
} | |
class Me extends Person { | |
constructor(beauty: { beauty: number }) { | |
super(24, "Me"); | |
this.beauty = beauty; | |
} | |
private blackList: Set<Person> = new Set(); | |
public beauty: { beauty: number }; | |
public inviteToDate(person: Person) { | |
console.log(`Me invited ${person.name} to a date`); | |
} | |
public addPersonToBlackList(person: Person) { | |
this.blackList.add(person); | |
} | |
public startSearchingForAnotherPersonToDate() { | |
// void | |
} | |
} | |
const me = new Me({ beauty: 2.3 }); | |
const girl = new Girl({ beauty: 8.5 }); | |
me.inviteToDate(girl); | |
if (girl.getExchangeRateRegime() === EXCHANGE_RATE_REGIMES.FLOATING_EXCHANGE) { | |
// Continue dating her | |
} else { | |
me.addPersonToBlackList(girl); | |
me.startSearchingForAnotherPersonToDate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment