Created
October 15, 2019 17:05
-
-
Save saiumesh535/f705947805076882beccb33e971f38db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type Http struct { | |
} | |
func (http *Http) Get(url string) string { | |
return fmt.Sprintf("the result from %s is nothing", url) | |
} | |
type NamesService struct { | |
Http *Http | |
} | |
func (service *NamesService) get_name_service(name string) string { | |
return fmt.Sprintf("name is %s and url is %s", name, service.Http.Get("http://loical")) | |
} | |
type GetNames struct { | |
Service NamesService | |
} | |
func (names *GetNames) get_name(name string) string { | |
return names.Service.get_name_service("umesh") | |
} | |
func main() { | |
http := &Http{}; | |
service := NamesService{Http:http} | |
names := GetNames{Service:service} | |
fmt.Println("Hello!!", names.Service.get_name_service("umesh")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment