Anonamously referencing procedures within a class
Author |
Message |
TheOneTrueGod
|
Posted: Thu Jun 08, 2006 4:36 pm Post subject: Anonamously referencing procedures within a class |
|
|
I don't know if I used the terminology right there, but eh.
code: |
class Stuff
export WriteThis
procedure WriteThis (s : string)
put s
end WriteThis
procedure WriteFirstCharacter (s : string)
put s(1)
end WriteFirstCharacter
end Stuff
|
Allright, now if I wanted to anonamously reference that procedure, is there any way to go about doing that?
code: |
%Imaginary Syntax to show what I want to do
var q : array 1..2 of procedure p (s : string)
q(1) := Stuff.WriteThis
q(2) := Stuff.WriteFirstCharacter
|
Is there any possible way to do this? I've tried creating a pointer to the class, and assigning q to the procedure that way, but it didn't work... |
|
|
|
|
|
Sponsor Sponsor
|
|
|
HellblazerX
|
Posted: Thu Jun 08, 2006 4:42 pm Post subject: (No subject) |
|
|
I understand what you're asking. I believe what you're looking for is an abstract class, or an abstract procedure, however, since I've never looked into Turing classes, I'm not sure if they exist in Turing. |
|
|
|
|
|
Cervantes
|
Posted: Thu Jun 08, 2006 5:11 pm Post subject: (No subject) |
|
|
No, you can't do that. The reason being that those procedures only exist for instances of the Stuff class, not for the class itself.
What you're looking for is a module. |
|
|
|
|
|
TheOneTrueGod
|
Posted: Thu Jun 08, 2006 5:48 pm Post subject: (No subject) |
|
|
Darn. Thanks for your help man. A module wouldn't be useful in the instance I was asking this about. (Unfortunately, I forgot the instance I was trying to figure out a way around it for like a week, so I finally gave up and posted the question on here, for future reference, but I can't remember what the actual instance of it was...) |
|
|
|
|
|
|
|