My favorites
▼
|
Sign in
dwscript
Delphi Web Script general purpose scripting engine
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
Test
/
SimpleScripts
/
virtual_constructor.pas
‹r12
r1490
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
Demonstrates that OOP really works in DWSII!
}
type
TClassA = class
protected
str: string;
public
constructor Create; virtual;
class procedure Test; virtual;
property strProp : String read str;
end;
type
TClassB = class(TClassA)
public
constructor Create; override;
class procedure Test; reintroduce;
end;
constructor TClassA.Create;
begin
str := 'A';
end;
class procedure TClassA.Test;
begin
PrintLn('TestA');
end;
constructor TClassB.Create;
begin
str := 'B';
end;
class procedure TClassB.Test;
begin
PrintLn('TestB');
end;
var
cls: class of TClassA;
var
o: TClassA;
cls := TClassB;
o := cls.Create;
PrintLn(o.strProp);
o.test; // call static method
TClassB(o).test;
Show details
Hide details
Change log
r494
by zarglu on Feb 1, 2011
Diff
Enforce class visibility constraints
Go to:
/trunk/Source/dwsComConnector.pas
/trunk/Source/dwsComp.pas
/trunk/Source/dwsCompiler.pas
/trunk/Source/dwsCoreExprs.pas
/trunk/Source/dwsExprs.pas
/trunk/Source/dwsSymbols.pas
...k/Source/dwsVariantFunctions.pas
...t/FailureScripts/visibility1.pas
...t/FailureScripts/visibility1.txt
...t/FailureScripts/visibility2.pas
...t/FailureScripts/visibility2.txt
...t/FailureScripts/visibility3.pas
...t/FailureScripts/visibility3.txt
...t/FailureScripts/visibility4.pas
...t/FailureScripts/visibility4.txt
...t/FailureScripts/visibility5.pas
...t/FailureScripts/visibility5.txt
...eScripts/virtual_constructor.pas
/trunk/Test/UdwsClassesTests.pas
/trunk/Test/UdwsUnitTests.pas
Project members,
sign in
to write a code review
Older revisions
r12
by zarglu on Aug 24, 2010
Diff
SVN initial import
All revisions of this file
File info
Size: 784 bytes, 53 lines
View raw file
Powered by
Google Project Hosting