Quote:
Originally Posted by BAILOPAN
Yes, you can do this. I don't really understand your efficiency question, but since methodmaps don't allocate memory it shouldn't matter. There are a few antipatterns in your code though. In general it is not a good idea to have one parameter mean something entirely different based on a flag. It's better to do this:
PHP Code:
methodmap BaseMap { public BaseMap(int client) { return view_as<BaseMap>(GetClientUserId(client)); }
public static BaseMap FromUserId(int userid) { return view_as<BaseMap>(userid); }
property int userid { public get() { return view_as<int>(this); } } property int index { public get() { return GetClientOfUserId(this.userid); } } };
This is a common way of having two constructors for clarity:
PHP Code:
BaseMap map1 = BaseMap(client); BaseMap map2 = BaseMap.FromUserId(userid);
Constructing an object multiple times just to access properties is also an anti-pattern, but since your methodmap doesn't do anything effectful or expensive it doesn't matter.
|
I see, thanks Bailopan! Before I stop lurking for a long time, I have one last question.
Are timers still limited to 0.1 seconds for the smallest possible interval or has this been changed?
If they still are limited to 0.1s, will that change in the future?
__________________