The comments explain a lot in the code.
Im trying to make a function that returns the type of animal, and pass that function as a parameter. There since to be a problem with type conversion.
The three send functons are sending me the info i need.


@JustinObanor I made a couple of corrections to your code here:

Your type conversion was working just fine. It was that your function was expecting a return type of Animalizer, but you were already accessing the typeOfAnimal(). This method returns a string type.

	//trying to make a function that gives me the type of animal from the first struct. Will make others later
	//error is from here. Not sure how to return the typeOfAnimal
	a1 := func() Animalizer {
		var a Animalizer
		switch a.(type) {
		case Animal1:
			return a.(Animal1).typeOfAnimal()

Yeah, but the things that im trying to return the Animalizer interface, and not a string…can i make that possible?


Yes, just take off typeOfAnimal() method off of a.(Animal1).typeOfAnimal().


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.