aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.go/methods.go
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.go/methods.go')
-rw-r--r--gdb/testsuite/gdb.go/methods.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.go/methods.go b/gdb/testsuite/gdb.go/methods.go
new file mode 100644
index 0000000..563d0e4
--- /dev/null
+++ b/gdb/testsuite/gdb.go/methods.go
@@ -0,0 +1,21 @@
+package main
+
+import "fmt"
+
+type T struct { i int }
+
+func (t T) Foo () {
+ fmt.Println (t.i)
+}
+
+func (t *T) Bar () {
+ fmt.Println (t.i)
+}
+
+func main () {
+ fmt.Println ("Shall we?")
+ var t T
+ t.Foo ()
+ var pt = new (T)
+ pt.Bar ()
+}