Код: Выделить всё
class BB
{
public:
//constructors
BB() { bb = 0; };
BB(double bb) : bb(bb) { bb = 0; };
//functions & procedure
void setValue(double i) { bb = i; return; };
double getValue() { return bb; };
//operators
BB &operator << (double i)
{
bb = (bb + i) / 2;
return (BB &)this;
};
private:
double bb;
};
вот так вот работает:
Код: Выделить всё
BB sum(1);
sum << 2 << 3;
ShowMessage(sum.getValue());
а так не работает а надо что б работало, как сделать правильно?
пишет: "[BCC32 Error] Unit1.cpp(358): E2087 Illegal use of pointer"
Код: Выделить всё
BB * sum = new BB();
sum->setValue(1);
sum << 2 << 3;
ShowMessage(sum->getValue());
в чем моя ошибка? и чего я не понимаю? %) ?