标签:
package main import ( "fmt" ) type Encipher func(plaintext string) string func main() { p := "123" s := GenEncryptionFunc(Test) fmt.Println(s(p)) } func GenEncryptionFunc(encrypt Encipher) func(string) (ciphertext string) { return func(plaintext string) string { return fmt.Sprintf("%s", encrypt(plaintext)) } } func Test(s string) string { return s + "321" }
标签:
原文地址:http://my.oschina.net/meilihao/blog/359422