Mail Archives: djgpp/1998/09/02/12:45:46
Hi Jorge!
First of all, are you from Portugal? Cause I'm writing from Brazil!
About your question:
I'm new in the DJGPP business, but, as far as I know, you can't transform
x (in your code) from "complex" to "double".
But you can do something like:
complex x(5, 3);
double a = x;
All you have to do is to create a "converter" between types:
class complex {
.
.
.
operator double() const { return real; }
}
Or something like that! That technique is called typecasting. You can also
add some features to your class to prevent using imaginary part when
dealing with float or double (it depends on your needs). OK?
Renato Fernandes CANTAO
DMA - IMECC - UNICAMP
Campinas - SP - Brasil
- Raw text -