Einzelnen Beitrag anzeigen

bra

Registriert seit: 20. Jan 2015
711 Beiträge
 
Delphi 10.2 Tokyo Enterprise
 
#14

AW: records oder klassen?

  Alt 23. Mai 2016, 13:40
Ein Record ist ein Bei Google suchenValue Type und eine Klasse ist ein Bei Google suchenReference Type. Aufgrund dessen erfolgt die Ablage auf dem Stack bzw. Heap.
http://docwiki.embarcadero.com/RADSt....28advanced.29

Records are value types, so they are copied on assignment, passed by value, and allocated on the stack unless they are declared globally or explicitly allocated using the New and Dispose function. Classes are reference types, so they are not copied on assignment, they are passed by reference, and they are allocated on the heap.

Records are constructed automatically, using a default no-argument constructor, but classes must be explicitly constructed. Because records have a default no-argument constructor, any user-defined record constructor must have one or more parameters.
  Mit Zitat antworten Zitat