On Sat, 20 Jun 2009, Pritpal Bedi wrote:

Hi,

I do not know what exactly you are asking for but maybe some
information can help you to find the answer.

> Please look at this code
> CREATE CLASS XbpComboBox INHERIT XbpSLE, XbpListBox
> ENDCLASS
> METHOD XbpComboBox:new( ... )
>    ::XbpSLE:init( ... )
> RETURN Self
> METHOD XbpComboBox:create( ... )
>    ::XbpSLE:create( ... )
> RETURN Self
> 
> Function Main()
>    Local oCombo 
>    oCombo := XbpComboBox( ... )

Here is a difference between xbase++ and Harbour. XbpComboBox() is
class function. In xbase++ just like in Class(y) class functions return
class object not the object of given class. It's necessary to send
new() message to this object to create new object of XbpComboBox class.
So in xbase++ above code should look like:
   oCombo := XbpComboBox():new( ... )

>    oCombo:xbpSLE:callSomeFunOrProperty()
>    ^^^^^^^^^^^^^^^^^^^^^^^^^
>    // Where IS the instance of <oCombo:xbpSLE> called above.
>    // I need to know can I manage this instance.

XbpSLE is cast message. It returns special pseudo object which
causes that any message send to it will be taken from XbpSLE
class but sent to original oCombo object. It's usable when you
have methods or instance variables with the same name in few
different ancestor classes and you want to chose the one which
belongs to exactly given class. If there is no name conflict then:
   oCombo:xbpSLE:callSomeFunOrProperty()
should have the same behavior as:
   oCombo:callSomeFunOrProperty()
Messages are sent from left to right so this code:
   (oCombo:xbpSLE):callSomeFunOrProperty()
has the same meaning.

> Return nil
> My query may not be well-explained!

I do not know I answered to your question but I hope it helps.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to