Call an object method: Difference between revisions
no edit summary
Recombinant (talk | contribs) m (→{{header|Zig}}: update to use Zig's testing) |
No edit summary |
||
Line 738:
Hello static world!
</pre>
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
local fn FBClassDemo
// Class
ClassRef class = fn MutableStringClass
// Cocoa base class name as human-readable string
print fn StringFromClass( class )
// Instantiate
CFMutableStringRef mutStr = fn MutableStringNew
// Method with single argument
MutableStringAppendString( mutStr, @"Hello, World!" )
print mutStr
// Method with multiple arguments
MutableStringReplaceAllOccurrencesOfString( mutStr, @"World", @"Rosetta Code" )
print mutStr
end fn
fn FBClassDemo
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
NSMutableString
Hello, World!
Hello, Rosetta Code!
</pre>
=={{header|Go}}==
Go distances itself from the word "object" and from many object oriented concepts. It does however have methods. Any user-defined type in Go can have methods and these work very much like "instance methods" of object oriented languages. The examples below illustrate details of Go methods and thus represent the concept of instance methods.
|