Forum > FPC development

Extended Record

(1/1)

SonnyBoyXXl:
The advanced records are a cool feature. Would it be possible to implement a type of inheritance like this way:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TMyRecord = record    x: integer;    y: integer;end; TMyRecord2 = extends record (TMyRecord)    z: integer;end; 
So TMyRecord2 will have 3 elements: x,y, and z

ASerge:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  TMyRecord = object    X: Integer;    Y: Integer;  end;   TMyRecord2 = object(TMyRecord)    Z: Integer;  end;Without virtual functions, its size is the same as the records.

PascalDragon:

--- Quote from: SonnyBoyXXl on November 02, 2021, 10:57:22 pm ---The advanced records are a cool feature. Would it be possible to implement a type of inheritance like this way:
--- End quote ---

No. If you need inheritance then use object.

Navigation

[0] Message Index

Go to full version