Forum Discussion
3 Replies
- joetestaRoku GuruPerhaps you can add two fields to the BaseClass, a boolean that signals BaseClass to run its SayHello function and the other field that receives the value returned by that function. Then the ExtendedClass could make use of those fields to call and receive the BaseClass SayHello value.
- joetestaRoku Guruin BaseClass.xml
<field id="runSayHello" type="boolean" alwaysNotify="true" onChange="onRunSayHello" />
<field id="sayHelloResponse" type="string" />
in BaseClass.brssub onRunSayHello()
m.top.sayHelloResponse = SayHello()
end sub
in ExtendedClass.brssub getBaseSayHello()
m.top.observeField("sayHelloResponse","gotResponse")
m.top.runSayHello = true
end sub
sub gotResponse()
print "Response: "; m.top.sayHelloResponse
end sub - georgejecookStreaming StarThanks,
I use this strategy pattern extensively, in all languages. I was hoping that there'd be a provision for simple overriding; but more widely using deference, as you suggest, is just as good a solution.
Appreciate the code snippets! Thanks!