I have class:
class Cline
{
public:
Cline ():ax(1),by(1),c(0){}
Cline (double aa, double bb,double cc):ax(aa*(-1)),by(bb),c(cc){
if(by==0){
exit(1);
}
}
Pkt operator* (const Cline & p)
{
if(p.ax != this->ax)
{
Pkt pkt;
double x=this->ax+(p.ax*(-1));
double c=(this->c*-1)+p.c;
pkt.x=c/x;
pkt.y=(this->ax*pkt.x+this->c)/this->by;
return pkt;
}
else
{
cout<<"no connection";
}
}
void setAX(double w){ax=w;}
void setBY(double w){by=w;}
void setC(double w){c=w;}
double getAX(){return ax;}
double getBY(){return by;}
double getC(){return c;}
private:
double ax;
double by;
double c;
};
when I use two times second constructor:
int main()
{
Cline z(1,1,1);
Cline w(4,3,-12);
z*w;
return 0;
}
everything is ok but when I use first and second constructor:
int main()
{
Cline z();
Cline w(4,3,-12);
z*w;
return 0;
}
I recive error:
"no match for operators 'z*w' "
Could somebody tell me what I am doing wrong? I have no idea when lies my mistake :(