Does scar have any form of polymorphism because I would find it useful for a function I'm making.
Does scar have any form of polymorphism because I would find it useful for a function I'm making.
All Scars have the same phenotypes, so i don't think Scars are polymorphic.
But of course Scars don't belong to a panmictic population anyway, so the whole question of polymorphism is irrelevant. They do, however, occupy the same habitat at the same time, so i can see where the idea came from.
AWESOME 300 parody.
AND then watch this cool RC car video I made, in HD, then watch the other vids I've uploadedProud owner of "Efferator" my totally boted main account!
"You see, sometimes, science is not a guess" -Xiaobing Zhou (my past physics professor, with heavy Chinese accent)
Feroc1ty, no I don't believe so.
pl0xIn computer science, polymorphism is a programming language feature that allows values of different data types to be handled using a uniform interface. The concept of parametric polymorphism applies to both data types and functions. A function that can evaluate to or be applied to values of different types is known as a polymorphic function. A data type that can appear to be of a generalized type (e.g., a list with elements of arbitrary type) is designated polymorphic data type like the generalized type from which such specializations are made.
Well, is there any way I can make a function or a procedure take extra optional parameters?
Ex:
Procedure(opt1,opt2);
Procedure(opt1,opt2,opt3);
wait, from just guessing at what that quote means, a polymorphanism is a function that returns multiple value types, like string, integer, boolean ect?
also, just make the params an array.
SCAR Code:function dothis(arr: TVariantArray):variant;
var i : integer;
begin
for i := 0 to 3 do
writeln(arr[i]);
end;
ect. ect. of course, you can make this do what ever you want, with any type you want
so you can have as many params as you wish you just need to keep track of it all
Last edited by Awkwardsaw; 12-01-2009 at 10:06 PM.
<TViYH> i had a dream about you again awkwardsaw
Malachi 2:3
Or changing the type?
In java:
byte i = 3;
System.out.println((int)i);// <-- Changes the byte to an int type
I think you can do it with chars (actually 100% possitive) just havent tested.
You would do that in SCAR by
writeln(Integer(i)); I think :S
Originally Posted by irc
sigh woulda been too perfect to have that available, shoulda known that by now, anything you want you probly wont get
I want the function to be able to take 2 or 3 parameters, so whenever someone uses the include they wouldn't have to memorize 2 different functions, and simply add in an extra parameter if need be.
although this may be useless, and a little confusing/ messy, but this is a little example.
SCAR Code:program New;
{.Include SRL/SRL.scar}
function isbool(v : variant):boolean;
begin
try
if v or (not v) then
result := true;
except
end;
end;
function mouseuptext(Arr : TVariantarray): boolean;
begin
mmouse(arr[0], arr[1], arr[2], arr[3]);
if high(arr) >= 5 then
if arr[5] <> null then
begin
result := isuptext(arr[5]);
if not result then exit;
end;
result := true;
if (high(arr) < 4) then exit;
if not isbool(arr[4]) then
exit;
mouse(arr[0], arr[1], arr[2], arr[3], arr[4]);
end;
begin //[x, y, rx, ry, left(opt), uptext(opt)]
mousespeed := 15;
mouseuptext([306, 280, 0, 0]);
end.
if you test it out, and mess with it a little bit, this will either move the mouse, move the mouse, and check the uptext, both and click the mouse, or just click the mouse depending on what parameters you set up.
where
SCAR Code:mouseuptext([306, 280, 0, 0, true, 'wat']);
you NEED the first 4 parameters, if you do not want to click, then make "true" to 0, or ''. if you dont want to check an uptext, then simply dont set that parameter. if you just want to move the mouse, just fill in the first 4 parameters
am i helping/ making sence?
<TViYH> i had a dream about you again awkwardsaw
Malachi 2:3
no point in trying to add confusing crap to bypass the issue, was simply seeing if i could make it simpler but ill just make 2 functions instead of having 1.
'A_string_with_parameters_separated_by_underscores _would_have_the_same_problem', so FunctionBlah and FunctionBlahEx ftw imo
one could use a set to make AwkwardSaw's thing look prettier, if that helped anything.
SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
Programming Projects: NotePad | Tetris | Chess
Actually im not sure what is this all about but this could help: http://www.villavu.com/forum/showthread.php?t=43158 (most likely a whole different thing...)
You cannot. This is a feature in object oriented programming languages such as java or c++.
There are currently 1 users browsing this thread. (0 members and 1 guests)