A little c++ question
Hello guys.
I have a little question. When I make en object and I overload an operator. How can get access to it without using ->operator ?
For exemple if have an object like :
class cTest
{
public:
cTest()
{
i = 0;
}
cTest& operator =(int n)
{
i = n;
return *this;
}
private:
int i;
};
after if I do :
cTest Test1;
Test1 = 10;
Ok, it''s all right. It work fine.
But if I do :
cTest *Test2;
Test2 = new cTest;
Test2 = 10; don''t work
And I must doing Test2->operator =(10);
Is there another way to access to overloaded operators with a pointer ?
Thanks for answers
Thomas DecroyèreCheck out my blog at: http://thomas.decroyere.be
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement