Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

Can declare a reference to a value type in a method body?

$
0
0

Basically what the title says. I know AS support pass value types by reference on parameters, but it is possible to define a reference to a value type in a method body? For example I've registered a C++ Vector2 as a value type, each operations returns a reference to itself for method chaining.

engine->RegisterObjectMethod("Vector2", "Vector2& add(const Vector2 &in)", asMETHODPR(Vector2, add, (Vector2&), Vector2&), asCALL_THISCALL);
engine->RegisterObjectMethod("Vector2", "Vector2& sub(const Vector2 &in)", asMETHODPR(Vector2, sub, (Vector2&), Vector2&), asCALL_THISCALL);

Then it can be possible to do in AngelScript the following? or should I register it as a reference type …


Viewing all articles
Browse latest Browse all 17625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>