The Go Programming Language

Source file doc/progs/print_string.go

     1	// Copyright 2009 The Go Authors. All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	package main
     6	
     7	import "fmt"
     8	
     9	type testType struct {
    10		a int
    11		b string
    12	}
    13	
    14	func (t *testType) String() string {
    15		return fmt.Sprint(t.a) + " " + t.b
    16	}
    17	
    18	func main() {
    19		t := &testType{77, "Sunset Strip"}
    20		fmt.Println(t)
    21	}

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.