Skip to content

Instantly share code, notes, and snippets.

@harajune
Created August 12, 2022 03:35
Show Gist options
  • Select an option

  • Save harajune/18b5afbcd70e72838f8f7f0dcc03e074 to your computer and use it in GitHub Desktop.

Select an option

Save harajune/18b5afbcd70e72838f8f7f0dcc03e074 to your computer and use it in GitHub Desktop.
class Color {
constructor(
private red: number,
private green: number,
private blue: number
) { }
public equals(color: Color) {
return this.red === color.red &&
this.green === color.green &&
this.blue === color.blue
}
}
const appleColor = new Color(255, 0, 0)
const bloodColor = new Color(255, 0, 0)
console.log(appleColor.equals(bloodColor)) // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment