Home » U++ Library support » U++ Core » Beginners Question: How to return "NULL"
Beginners Question: How to return "NULL" [message #6675] |
Wed, 22 November 2006 14:31 |
WebChaot
Messages: 53 Registered: September 2006 Location: Austria, Vienna
|
Member |
|
|
Hi all!
Maybe a stupid question - but how to return "NULL":
I have a function which usually returns an object. But if no object is under the mouse position I want to return something like Null.
But not possible, because "invalid initialization of non-const reference of type 'PosObject&' from a temporary of type 'int'".
Here is the code:
==========================================================
xObject& xLayout :: GetObject(int id)
{
for (int i = xObjects.GetCount() - 1; i >= 0; i--)
{
if (xObjects.At(i).GetId() == id)
{
return xObjects.At(i);
}
}
return NULL; <<< === doesn't work
}
==========================================================
Thanks in advance,
WebChaot
|
|
|
|
Goto Forum:
Current Time: Sat May 11 15:59:48 CEST 2024
Total time taken to generate the page: 0.02442 seconds
|