Reflection vs. Generics
Let’s compare reflection and generics in Go.
We'll cover the following...
We'll cover the following...
In this lesson, we’ll develop a utility that prints the elements of a slice in two ways: first, using reflection, and second, using generics.
Coding example
The code of reflection.go is as follows:
Internally, the PrintReflection() function works with slices only. However, because we can’t express that in the function ...