lundi 14 décembre 2020

In Go, is there anything like Java's Class.newInstance?

  1. I know there is no default constructor in Go.
  2. I want to new some "decoder" at runtime, according to received message's type.

So, what can I do? Use a map, key is the name of type, value is some wrapper function to init/new?





Aucun commentaire:

Enregistrer un commentaire