[Progress Communities] [Progress OpenEdge ABL] Comment on Allow PROTECTED and PRIVATE accessors in interface

  • Thread starter Thread starter frank.meulblok
  • Start date Start date
Status
Not open for further replies.
F

frank.meulblok

Guest
I disagree with this Idea. The purpose of an Interface type is only to enforce a set of public class members, so that any code referencing an interface type can work with any class instance that implements that interface type. If you do not want to expose a property getter/setter to the public in an interface, simply omit it from the interface defnition. That already works: /* interface */ INTERFACE iStuff: DEFINE PUBLIC PROPERTY SomeStuff AS CHARACTER SET. DEFINE PUBLIC PROPERTY OtherStuff AS CHARACTER GET. END. /* Class that implements interface */ CLASS myStuff IMPLEMENTS iStuff: DEFINE PUBLIC PROPERTY SomeStuff AS CHARACTER PROTECTED GET. SET. DEFINE PUBLIC PROPERTY OtherStuff AS CHARACTER GET: RETURN SomeStuff. END GET. PRIVATE SET. END. /* code that references class through interface */ DEFINE VARIABLE stuff AS iStuff NO-UNDO. /* this all works as expected. Class implementation stuff = NEW myStuff(). stuff:somestuff = "stuff". MESSAGE stuff:otherstuff. /* these lines fail to compile, as expected. */ /*MESSAGE stuff:somestuff. stuff:otherstuff = "stuff".*/

Continue reading...
 
Status
Not open for further replies.
Back
Top