Can I overload operators for my own classes in Delphi?

I faced a little trouble - I do not know if I can define my own operators for my classes. For example:

type
  TMinMatrix = class(TMatrix)
    private
      RowAmount: Byte;
      ColAmount: Byte;
      Data: DataMatrix;
      DemVector, SupVector: SupplyDemand;
    public
      constructor Create(Rows, Cols: Byte);
      function GetRowAmount: Byte; override;
      function GetColAmount: Byte; override;
      destructor Destroy;
  end;

How can I - or can`t I:) - do something like:

TMinMatrix TMinMatrix::operator=(TMinMatrix* matr)    (c++ code)

And, by the way, can I define copy constructor for my class?

Answers


Operator overloading is possible in Delphi .NET versions, older versions of Delphi don't support it.


Delphi Win32 2007 and 2009 only supports class operator overload for records, you can have implicit and explicit operators. Delphi .Net supports class operators for records and classes.


Need Your Help

.Net Framework 4.0 - Opcodes.Box present in Dictionary with int key

c# .net dictionary garbage xbox360

I'm trying to investigate whether dictionaries with enum keys still generate garbage in newer versions of .Net (say >= 4)

AspectJ load-time weaving for signed jars

java tomcat aop aspectj load-time-weaving

Does anybody success in using AspectJ load-time weaving with signed jars?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.