Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test.py
Go to the documentation of this file.
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 try:
52  x.PVMethod()
53 except:
54  print "*** Runtime ERROR occured!" \
55  " because pure virtual function is called."
def AMethod
Definition: test.py:11
def PVMethod
Definition: test.py:23
def VMethod
Definition: test.py:17