Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. interface IAnimal {
  2. type: string
  3. name: string
  4. printName: Function
  5. printType: Function
  6. }
  7.  
  8. class Bird implements IAnimal {
  9. type: string
  10. name: string
  11. constructor(name: string) {
  12. this.type = 'bird'
  13. this.name = name
  14. }
  15. printName() {
  16. console.log(this.name)
  17. }
  18. printType(){
  19. console.log(this.type)
  20. }
  21. }
  22.  
  23.  
  24. const b = new Bird('hi')
  25. b.printName()
  26. b.printType()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement