User137
14-08-2010, 09:47 AM
1) Inheriting from multiple classes
Is it possible to for example do something like this (didn't work when tried):
type
TGameObject = class
public
name: string;
end;
TObjButton = class(TGameObject)
public
pressed: boolean;
end;
TGLObjectProperties = class
public
texture: string;
end;
TGLButton = class(TObjButton, TGLObjectProperties)
public
procedure Draw;
end;
So it would inherit properties from 2 sub-classes.
2) else-if stack
I have a long structure of if's like:
if s='new' then begin
// ...
end else if s='add' then begin
end else if s='remove' then begin
...
end;
The strings are fictional in example but idea same. Reading multiple "commands" from textfile where i want to keep the format human-readable, therefore i do not want to save the commands as numbers instead.
Is there a stack limit to if's? Compiler doesn't support real "elseif" command but does it internally do it? Should we be starting to get worried and request a string support for "case" structure? xx(
I know i could also do workaround like having a string-array indexed for the commands and go through the list to find matching number, and finally using that in "case" structure.
Is it possible to for example do something like this (didn't work when tried):
type
TGameObject = class
public
name: string;
end;
TObjButton = class(TGameObject)
public
pressed: boolean;
end;
TGLObjectProperties = class
public
texture: string;
end;
TGLButton = class(TObjButton, TGLObjectProperties)
public
procedure Draw;
end;
So it would inherit properties from 2 sub-classes.
2) else-if stack
I have a long structure of if's like:
if s='new' then begin
// ...
end else if s='add' then begin
end else if s='remove' then begin
...
end;
The strings are fictional in example but idea same. Reading multiple "commands" from textfile where i want to keep the format human-readable, therefore i do not want to save the commands as numbers instead.
Is there a stack limit to if's? Compiler doesn't support real "elseif" command but does it internally do it? Should we be starting to get worried and request a string support for "case" structure? xx(
I know i could also do workaround like having a string-array indexed for the commands and go through the list to find matching number, and finally using that in "case" structure.