Quantcast
Channel: Delphi – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 1445

Oh nice. Feel free to QP. E2003WithConstsInDescendingClassesConsoleProject

$
0
0

Oh nice. Feel free to QP. Fails at least in Delphi XE8.

program E2003WithConstsInDescendingClassesConsoleProject;

{$APPTYPE CONSOLE}

uses
ParentUnit in 'ParentUnit.pas',
ChildUnit in 'ChildUnit.pas';

begin
end.
unit ParentUnit;

interface

type
  TParent = class
  // section can be strict protected, protected, public, published or nothing
  const
    InitialBooleanValue = False;
    InitialIntegerValue = -1;
  end;

implementation

end.
unit ChildUnit;

interface

uses
  ParentUnit;

type
  TChild = class(TParent)
  // section can be strict protected, protected, public, published or nothing
  const
//    Initial and final values need to be different to test the behaviour
    FinalBooleanValue = not InitialBooleanValue;
    FinalIntegerValue = InitialIntegerValue + 1;
//[dcc32 Error] ChildUnit.pas(13): E2003 Undeclared identifier: 'InitialBooleanValue'
//[dcc32 Error] ChildUnit.pas(14): E2003 Undeclared identifier: 'InitialIntegerValue'
//[dcc32 Error] ChildUnit.pas(14): E2026 Constant expression expected
  end;

implementation

end.

[WayBackOh nice. Feel free to QP. unit ParentUnit; interface type TParent = class …


Viewing all articles
Browse latest Browse all 1445

Trending Articles