Skip to content

Commit 9231086

Browse files
author
gmjason
committed
added readme for example1
1 parent d0cfa32 commit 9231086

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

example1-inheritance/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
# Example1 - Inheritance
3+
4+
This is the inheritance example. The important parts are commented in the source code. The main differences can be achieved by letting the inheritance-class struct inherit the base-class struct. The base-class type must also be to the inheritance-class type block (there is an argument).
5+
6+
# Example
7+
8+
```python
9+
from my_module import BaseClass
10+
bc = BaseClass()
11+
inh = InheritanceClass()
12+
13+
## Use a base class function. It just returns the arguments.
14+
bc.some_base_function("some_string")
15+
# >>> "some_string"
16+
bc.some_base_function("some_string","some_string2")
17+
# >>> "some_string2"
18+
19+
## Test the inheritance class for the base class function too
20+
inh.some_base_function("some_string")
21+
# >>> "some_string"
22+
inh.some_base_function("some_string","some_string2")
23+
# >>> "some_string2"
24+
```

0 commit comments

Comments
 (0)