Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. /*
  2. So what I want to do is to give a configuration object to every controller
  3. and the controller can call only specific methods on it.
  4. */
  5.  
  6. type SuperInterface interface {
  7. myfunc()
  8. }
  9.  
  10. type SuperClass struct{}
  11.  
  12. func (s SuperClass) myfunc() {
  13.  
  14. }
  15.  
  16. func (s SuperClass) myfunc2() {
  17.  
  18. }
  19.  
  20. func someCallable(s SuperInterface) {
  21. s.myfunc() // legal
  22. s.myfunc2() // illegal
  23. }
  24.  
  25. func test() {
  26. a := SuperClass{}
  27. someCallable(a)
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement