So I have a class and a question for manipulating this class with pointers..
1 2 3 4 5 6 7 8 9 10 11 12 13 14
class Rain : public AnotherClass
{
};
// now i try to make a pointer to an array of that class.
typdef Rain* pRain;
pRain *p;
Rain drops[300];
p = drops;
(*p+j).SetPosition(Randomfloatx[j], Randomfloaty[j]);
Why cant I use pointer arithmetic on this special class?
It basically says in the compiler that my only options to add diffClass operator+(diffclass, diffclass)
Does this mean I have to redesign that operator for pointer arithmetic?
raintest.cpp:73: error: no match for ‘operator+’ in ‘* p + j’
/usr/local/include/SFML/Graphics/Color.hpp:131: note: candidates are: sf::Color sf::operator+(const sf::Color&, const sf::Color&)
Oh i see, that's what i forgot about the pointers to classes. They use the '->' to use members etc.
EDIT: Actually that doesn't work.
Here's my code... But it is exceptionally bad. I hven't really even checked the logic... It was all on the fly coding... so I was actually just trying to get it to work.