Implementing Interface's method on Union state #745
Unanswered
ericodarmawanh
asked this question in
Q&A
Replies: 1 comment
-
Hello! Yes, there's no choice. If the getMessage wasn't part of the IError interface, you could use an extension instead. But because of the interface, you'll have to it as you've shown. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's say that I have an interface IError which has a method to implement like this:
![FavJrMfVEAModH3](https://user-images.githubusercontent.com/69150523/186479764-2e2a9643-66dc-4c4e-a20d-b089faba11aa.jpeg)
![FavJvs_UYAApl5p](https://user-images.githubusercontent.com/69150523/186481566-17d439f8-04ad-44e0-9058-6b658115db6b.jpeg)
Now, one of my Union's state implements it. The question is: Is this the right way to implement the method? I doubt my self because now the success state has the method too. It's happened because I create the method inside the Union class.
Thank you for the answer.
Beta Was this translation helpful? Give feedback.
All reactions