ExeterBScDTS / ECM3440-Python-classes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ECM3440-Python-classes

Examples and exercises in designing, building, and testing classes.

Operator overloading

The built-in numeric types in Python can be combined in the usual ways using operators such as + and -. This facility can be added to your own classes through what is called operator overloading. This can be applied to any type you create, not just those that represent numbers, but do take care not to confuse your users.

Reminder. Python strings make use of operator overloading.

print ("Hello " + "world")
print ("_" * 11)
Hello world
___________

Operator overloading exercise

Domain-Driven Design

In DDD we identify entities, values, and services.

DDD services exercise

About

License:Mozilla Public License 2.0


Languages

Language:Python 100.0%