Ways to "Add Component from class"?

I also don’t understand how to implement this.