Hacker News new | ask | show | jobs
by nh23423fefe 868 days ago
yes

  // You can edit this code!
  // Click here and start typing.
  package main

  import "fmt"

  func main() {
   duck := Duck{}

   identity(duck).quack()
  }

  func identity[T any](t T) T {
   return t
  }

  type Duck struct{}

  func (d Duck) quack() {
   fmt.Println("quack")
  }

  /*
  quack

  Program exited.
  */