[Gambas-user] OO design problem?

Jussi Lahtinen jussi.lahtinen at ...626...
Sun Aug 28 20:37:36 CEST 2016


I have class which is meant only to function as parent to other classes.
This class have empty properties and methods, which are there only to be
over-driven in the children classes. If I remove them I get error that the
properties are not declared, and if I remove the properties from the parent
I cannot use them when the object is passed as the parent.

So, is it be possible to do this without declaring empty _read functions
and _write subs?

I want to be able to pass the objects like this:

Sub DoSomething(hAnyChildrenOfThisClass As ThisClass)

  x = hAnyChildrenOfThisClass.SomethingElse()
  ...

End


Now the "SomethingElse" must be declared in "ThisClass" so that the
children can have it and over-drive it with actual content.
So, I'm looking a way to write only this:

In ThisClass:

Property SomethingElse  As Interger


Instead of all this, which make a lot of unnecessary mess:

Property SomethingElse  As Interger


Private Function SomethingElse_Read() As Integer

  Return 0

End

Private Sub SomethingElse_Write(Value As Integer)

End


It's very likely that I have missed something and I have some crucial
design problem. So all suggestions are welcome!
Thanks!


Jussi



More information about the User mailing list