Source:
namespace Interface is
interface Mungible is
void mung();
get int Girth;
si
class Widget do Mungible is
String name;
void init(String n) is
this.name = n;
si
void mung() is
name = name.UpperCase;
si
get int Girth is
return 1;
si
String toString() is
return "Widget(" + name + ")";
si
si
class Mumble do Mungible is
String[] values;
void init( String[] v) is
values = v;
si
void mung() is
for var i = 0; i < values.length; i = i + 1 do
values[i] = values[i].UpperCase;
od
si
get int Girth is
return values.length;
si
String toString() is
return "Mumble(" + values + ")";
si
si
class Main is
void testMunging( Mungible m ) is
IO.Std.out.println( m.Class.Name + " is: " + m.toString() + " with girth: " + m.Girth );
m.mung();
IO.Std.out.println( m.Class.Name + " after munging is: " + m.toString() );
si
void init() is
var w = new Widget( "widget" );
testMunging(w);
var m = new Mumble( { "mumble", "fidget", "mumble" } );
testMunging(m);
si
si
si
LSPPage.P_21679_14.Interface.Widget is: Widget(widget) with girth: 1
LSPPage.P_21679_14.Interface.Widget after munging is: Widget(WIDGET)
LSPPage.P_21679_14.Interface.Mumble is: Mumble(mumble,fidget,mumble) with girth: 3
LSPPage.P_21679_14.Interface.Mumble after munging is: Mumble(MUMBLE,FIDGET,MUMBLE)
LSPPage.P_21679_14.Interface.Widget after munging is: Widget(WIDGET)
LSPPage.P_21679_14.Interface.Mumble is: Mumble(mumble,fidget,mumble) with girth: 3
LSPPage.P_21679_14.Interface.Mumble after munging is: Mumble(MUMBLE,FIDGET,MUMBLE)
site design and content copyright (C) jeek 1995-2010  
[
13132
]