Last change
on this file since 1354 was
1337,
checked in by garnier, 14 years ago
|
tag geant4.9.4 beta 1 + modifs locales
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Rev | Line | |
---|
[1337] | 1 | #!/usr/bin/python |
---|
| 2 | # ================================================================== |
---|
| 3 | # python script for Geant4Py test |
---|
| 4 | # |
---|
| 5 | # |
---|
| 6 | # ================================================================== |
---|
| 7 | import test06 |
---|
| 8 | |
---|
| 9 | class MyZClass1(test06.ZBase): |
---|
| 10 | "My Class derived from ZBase(C++)" |
---|
| 11 | def AMethod(self): |
---|
| 12 | print "MyZClass::AMethod is called:" |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | class MyZClass2(test06.ZBase): |
---|
| 16 | "My Class derived from ZBase(C++)" |
---|
| 17 | def VMethod(self, message): |
---|
| 18 | print "MyZClass::VMethod is called:", message |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | class MyXClass(test06.XBase): |
---|
| 22 | "My Class derived from XBase(C++)" |
---|
| 23 | def PVMethod(self): |
---|
| 24 | return "PVMethod is called from MyClass" |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | print "*** ZBase..." |
---|
| 28 | z= test06.ZBase() |
---|
| 29 | z.AMethod() |
---|
| 30 | z.VMethod("hello world") |
---|
| 31 | |
---|
| 32 | print "" |
---|
| 33 | print "*** Inherit from ZBase class..." |
---|
| 34 | myz1= MyZClass1() |
---|
| 35 | myz1.AMethod() |
---|
| 36 | myz1.VMethod("XXXX") |
---|
| 37 | |
---|
| 38 | print "*** w/ override" |
---|
| 39 | myz2= MyZClass2() |
---|
| 40 | myz2.VMethod("YYYY") |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | print "" |
---|
| 44 | print "*** Inherit from XBase, pure virtual class..." |
---|
| 45 | myx= MyXClass() |
---|
| 46 | print "myx.ival=", myx.ival |
---|
| 47 | print myx.PVMethod() |
---|
| 48 | |
---|
| 49 | print "" |
---|
| 50 | x= test06.XBase() |
---|
| 51 | print "*** Runtime ERROR will occur!" \ |
---|
| 52 | " because pure virtual function is called." |
---|
| 53 | x.PVMethod() |
---|
| 54 | |
---|
| 55 | |
---|
Note: See
TracBrowser
for help on using the repository browser.