GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing tutorial.xgo.dev — XGo by Tutorials: Method Values and Expressions Method Values and ExpressionsMethod valueMethod values allow you to bind a method to a specific object, and then call the method as an ordinary function with the object implied, in a kind of closure. For example: The expression hello.Say creates a method value, binding the Say function to the specific variable hello, giving it a type of func(). So function values can be passed as function parameters Method expressionsMethod expressions let you transform a method into a function with the receiver as its first argument. For example: So if you defined a Point struct and a method func (p Point) Add(another Point), you could write Point.Add to get a func(p Point, another Point). But if the method has a pointer receiver, you need to write (*Type).Method in your method expression. For example: Next example: Encapsulation |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |