Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

distinct non visual objects' type

Status
Not open for further replies.

1rstSol

Programmer
Mar 8, 2005
6
FR
I have declared two non visual objects:
- uo_food
- uo_goodfood

I’d like to write 2 methods “eat” in a same non visual objects.
How can I do to distinct such call :

public subroutine eat(userobject n) // userobject should be a uo_food type
messagebox("info","food")
end subroutine

and

public subroutine eat(userobject n) // userobject should be a uo_goodfood type
messagebox("info","goodfood")
end subroutine

Thanks,
1rstSol
 
Is good food descended from food?

If so I am not sure you can overload a fucntion with a descendant - have to say I cannot remember ever having tried it.

I assume that you have dived in and given it a go and it told you to sod off?

Bill
 
Do I understand correctly, you want to create one non visual (say uo_Control) that contains two eat functions with the same argument only a different result based on the actual type of userobject you pass in?

I don't think that is possible, but maybe this is an idea..
Have the 'overal' non visual use a dynamic function call to call a eat function/sunroutine defined on uo_food and uo_goodfood.

Should be something like this.

On uo_food define:
public subroutine eat()
messagebox("info","food")
end subroutine

On uo_goodfood define:
public subroutine eat()
messagebox("info","goodfood")
end subroutine

On the ou_control (or whatever opject you want to use as a start) define:
public subroutine eat(userobject n) // userobject should be a uo_food type OR uo_goodfood
n.dynamic eat ()
end subroutine

Hope this helps..

Greetzz
Coretta (NL)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top