Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 23581, Win32 Operator Overloading - Complex numbers

by Hallvard Vassbotn Email: Anonymous


This example demonstrates the new operator overloading of record types supported by the Win32 compiler (DCC32) by implementing Complex numbers.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 10.0  to 10.0 171 downloads
Copyright: No significant restrictions


Size: 9,714 bytes
Updated on Fri, 04 Nov 2005 07:52:07 GMT
Originally uploaded on Fri, 26 Aug 2005 06:10:41 GMT
SHA1 Hash: 60A2FEF9EBE5E6A9F3FDE34C92CF4DCAD5AC0212
MD5 Hash: 37099ABC77B698E0FAB907A60AD8E111

    Explore the files in this upload

Description
About the Win32 Operator Overloading - Complex numbers Demo
This example demonstrates the new operator overloading of record types supported by the Win32 compiler (DCC32).

It includes a unit named Vassbotn.Vcl.Complex that is a direct port of the corresponding .NET unit called Borland.Vcl.Complex. As far as possible I've tried to make the Win32 port as compatible and complete as possible.

The code can be used as-is if you need a native and relatively fast TComplex implementation (compared with the Variant-based implementation provided in the VarCmplx unit).

The unit can also be used as a starting point for implementing your own records with operator overloading. The code demonstrates how to use the following new Win32 compiler features:

operator overloading for records, for example:
class operator Add(const Left, Right: TComplex): TComplex;

different visibility specifiers in records (such as strict private, private and public)
instance methods for records, for example:
function Modulus: Double;

class methods for records, for example:
class function From(const AReal, AImaginary: Double): TComplex; static;

class vars for records, for example:
class var Symbol: string;

simulating a class constructor for records, by using a private class procedure and the initialization section of the unit


Based on original code Copyright Borland
Adapted by Hallvard Vassbotn, http://hallvards.blogspot.com/

For more information, see http://hallvards.blogspot.com/

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03