Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. )
  6.  
  7. type A struct {
  8.  
  9. }
  10.  
  11. type B struct {
  12. A
  13. }
  14.  
  15. func (a* A) fun1() {
  16. fmt.Println("I'm in A.fun1()")
  17. a.fun2()
  18. }
  19.  
  20. func (a* A) fun2() {
  21. fmt.Println("I'm in A.fun2()")
  22. }
  23.  
  24.  
  25. func (b* B) fun2() {
  26. fmt.Println("I'm in B.fun2()")
  27. }
  28.  
  29. func main() {
  30. b := B{}
  31. b.fun1()
  32. }
  33.  
  34. I'm in A.fun1()
  35. I'm in A.fun2()
  36.  
  37. I'm in A.fun1()
  38. I'm in B.fun2()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement