// Test interception of protected assignments by the "assign" method
class foo {
protected var a;
protected var b;
operator := (prop, val) {
switch (prop) {
case public::a : self.(prop) = val;
default : throw oadl::AccessCheck;
}
}
}
proc main()
{
var x = new foo();
x.a = 10;
"x.a assigned to ", x.a, '\n';
try {
x.b = 20;
}
catch (e) {
"Assigning to x.b threw ", e, '\n';
}
}