Message-Id: <3.0.5.32.19980902134416.007a1100@pop3.ime.unicamp.br> Date: Wed, 02 Sep 1998 13:44:16 -0300 To: morgado AT mail DOT telepac DOT pt (Jorge Bruno S. S. Morgado), djgpp AT delorie DOT com From: Renato Fernandes =?iso-8859-1?Q?Cant=E3o?= Subject: Re: help - type conversion In-Reply-To: <35ed2f07.8501652@news.telepac.pt> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk 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