This file contains 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
class Money<T extends Money<T>> { | |
constructor( | |
private readonly _value: number | |
) { | |
} | |
equals(other: T) { | |
return this._value === other._value | |
} |
This file contains 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
class Money<T extends Money<T>> { | |
constructor( | |
private readonly _value: number | |
) { | |
} | |
equals(other: T) { | |
return this._value === other._value | |
} |
This file contains 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 MoneyType { | |
Dollar, | |
Yen | |
} | |
class Money { | |
constructor( | |
private readonly _value: number, | |
private readonly _type: MoneyType | |
) {} |
This file contains 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
// マーカーインターフェース | |
interface Money { | |
getValue(): number | |
} | |
class Dollar implements Money { | |
constructor(private readonly value: number) {} | |
getValue() { | |
return this.value |
This file contains 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
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 file contains 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
class Color { | |
constructor( | |
private red: number, | |
private green: number, | |
private blue: number | |
) { } | |
} | |
const appleColor = new Color(255, 0, 0) | |
const bloodColor = new Color(255, 0, 0) |
This file contains 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
const array = [1] | |
const anotherArray = [1] | |
const reference = array | |
console.log(array === reference) // true | |
console.log(anotherArray === reference) // false |
This file contains 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
const array = [1] | |
const anotherArray = [1] | |
console.log(array === anotherArray) |
This file contains 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
const value = 1 | |
const anotherValue = 1 | |
console.log(value === anotherValue) |
This file contains 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
class PdfMerger: | |
def __init__(self, outputFileName): | |
self._merger = PdfFileMerger() | |
self._outputFileName = outputFileName | |
def append(self, pdf): | |
self._merger.append(fileobj=pdf.fileObject, pages=(pdf.currentPage, pdf.currentPage + 1)) | |
def write(self): | |
self._merger.write(self._outputFileName) |
NewerOlder