The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.15 (Linux)
File Line Function
/showthread.php 906 errorHandler->error




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reference as return type.
#1
Is it possible to get a reference to an object through return type?
How do i do that?

for instance i want to make a simple function -
object findemptycell()
{
object o;
int i=0;
while (true)
{
o = retobject(i);
if (o != null)
{
if (o.category ==PowerCell)
{
if (o.position.x != nan)
{
message("sdsd");
return o;
}

}
i++;
}else break;
}
}
But this does not work.


Messages In This Thread
Reference as return type. - by clop1000 - 07-04-2016, 03:34 PM
RE: Reference as return type. - by krzys_h - 07-04-2016, 03:51 PM
RE: Reference as return type. - by clop1000 - 07-04-2016, 04:22 PM
RE: Reference as return type. - by krzys_h - 07-04-2016, 04:40 PM
RE: Reference as return type. - by clop1000 - 07-04-2016, 05:14 PM
RE: Reference as return type. - by krzys_h - 07-04-2016, 07:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)