How would you go about creating a vector class in Delphi? I would prefer to put all math related stuff into a DLL. Should I use a record or a class implementing an interface?
Pros of record approach:
- Fast and lightweight
- Value type
- Operator overloading
Cons of record approach:
- Implementation cannot be hidden in DLL (no inheritance, so no abstract base class for the DLL interface possible)
- Problems with records as properties of classes (
Class.VectorProp.X := 42
)
What do you think?