Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: inheritance of class constants?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Felix Porsch

Posts: 1
Registered: 9/24/08
inheritance of class constants?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 2, 2016 9:54 AM
Obviously, class constants are not inherited, while class vars are (see below).
Is this a bug?

Example:

unit ClassConstTest;

interface

type

TBaseClass = class
const N = 2;
const U : Integer = 2;
var X: Integer;
end;

TDerivedClass = class(TBaseClass)
const NArray : Array[0..TBaseClass.N-1] of Integer = (0, 2); // works
const MArray : Array[0..N-1] of Integer = (0, 2); // does not work
const PArray : Array[0..U-1] of Integer = (0, 2); // does not work either
property VarX: Integer read X; // works
end;

implementation

end.

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02