Aug 20, 2013 at 2:38pm UTC
Hi @all,
another Question:
Theres a class named "A" which has got a static function named "sfA".
Now I instance an object of class A and call a method from A called "fA".
The method fA calls sfA. And now the issue is: i need the value of a member from the object which called fA respectivly sfA, inside sfA.
Is there a smarter way to get the value of the member as to declare an new parameter for the sfA? sfA has to be static.
Thx for your Time.
Aug 20, 2013 at 2:43pm UTC
This might not be what you are looking for but: you could pass a pointer of your object to your static function. It could be seen as the same as passing an extra parameter,but if you need multiple members this would work perfectly.
Aug 20, 2013 at 2:46pm UTC
Yes, it is a better idea than mine :) but not exactly what i search for.
Aug 20, 2013 at 3:33pm UTC
Well AFAIK you will never be able to access non-static members from a static function any other way, by definition.
Aug 20, 2013 at 3:39pm UTC
Why do you make it static if it needs to access member variables?