Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface IAnimal {
- type: string
- name: string
- printName: Function
- printType: Function
- }
- class Bird implements IAnimal {
- type: string
- name: string
- constructor(name: string) {
- this.type = 'bird'
- this.name = name
- }
- printName() {
- console.log(this.name)
- }
- printType(){
- console.log(this.type)
- }
- }
- const b = new Bird('hi')
- b.printName()
- b.printType()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement