PDA

View Full Version : PowerBasic: 6th post from Bob about objects



ErosOlmi
08-08-2008, 12:37
http://www.powerbasic.com/support/pbforums/showthread.php?t=38155
_________________________________________________

What should a Class look like?

Petr Schreiber
08-08-2008, 16:53
Not bad,

a bit unusual, but what is most important - for invoking method there is finally no OBJECT CALL, so it can be used as any other function.



CLASS MyClass
INSTANCE Counter as Long
INTERFACE MyInterface
INHERIT iUnknown ' inherit the base class
Method BumpIt(Inc as Long) as Long
Temp& = Counter + Inc
Incr Counter
Method = Temp&
End Method
END INTERFACE
' more interfaces could be implemented here
END CLASS


It seems the Class-Interface relations ship is very similar to NameSpace-Class in other languages.
The model PB provides seems to be slightly different from what I know in Delphi/C#, but it is logical.


Petr

ErosOlmi
08-08-2008, 17:30
As José said, PB way is main tailored for COM automation world rather than OOP.
So while we will get a great improvement in COM handling (both as client or server) we will get at the same time some OOP methodology to play with. But it is not definitely OOP.