summaryrefslogtreecommitdiff
path: root/notebooks/python/python_oo.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'notebooks/python/python_oo.ipynb')
-rw-r--r--notebooks/python/python_oo.ipynb10
1 files changed, 8 insertions, 2 deletions
diff --git a/notebooks/python/python_oo.ipynb b/notebooks/python/python_oo.ipynb
index 9f0774a..fe717a9 100644
--- a/notebooks/python/python_oo.ipynb
+++ b/notebooks/python/python_oo.ipynb
@@ -735,7 +735,7 @@
735 "In object-oriented programming, inheritance is the mechanism of basing an object or class upon another object (prototype-based inheritance) or class (class-based inheritance), retaining similar implementation. Also defined as deriving new classes (sub classes) from existing ones such as super class or base class and then forming them into a hierarchy of classes.\n", 735 "In object-oriented programming, inheritance is the mechanism of basing an object or class upon another object (prototype-based inheritance) or class (class-based inheritance), retaining similar implementation. Also defined as deriving new classes (sub classes) from existing ones such as super class or base class and then forming them into a hierarchy of classes.\n",
736 "\n", 736 "\n",
737 "In most class-based object-oriented languages, an object created through inheritance, a \"child object\", acquires all the properties and behaviors of the \"parent object\" , with the exception of: constructors, destructor, overloaded operators and friend functions of the base class. \n", 737 "In most class-based object-oriented languages, an object created through inheritance, a \"child object\", acquires all the properties and behaviors of the \"parent object\" , with the exception of: constructors, destructor, overloaded operators and friend functions of the base class. \n",
738 "Inheritance allows programmers to create classes that are built upon existing classes, to specify a new implementation while maintaining the same behaviors (realizing an interface), to reuse code and to independently extend original software via public classes and interfaces.\n", 738 "Inheritance allows programmers to create classes that are built upon existing classes, to specify a new implementation while maintaining the same behaviors (realizing an interface), to reuse code and to independently extend original software via public classes and interfaces. It is a \"is-a\" relationship between base (parent) class and a derived (child) class.\n",
739 "\n", 739 "\n",
740 "One can simply view inheritance as a tool for code reuse.\n", 740 "One can simply view inheritance as a tool for code reuse.\n",
741 "\n", 741 "\n",
@@ -1048,7 +1048,13 @@
1048 "\n", 1048 "\n",
1049 "Not all classes admit a linearization. There are cases, in complicated hierarchies, where it is not possible to derive a class such that its linearization respects all the desired properties. \n", 1049 "Not all classes admit a linearization. There are cases, in complicated hierarchies, where it is not possible to derive a class such that its linearization respects all the desired properties. \n",
1050 "`TypeError: Cannot create a consistent method resolution order (MRO) for bases X, Y` is raised then.\n", 1050 "`TypeError: Cannot create a consistent method resolution order (MRO) for bases X, Y` is raised then.\n",
1051 "\n" 1051 "\n",
1052 "\n",
1053 "## The Liskov substitution principle (LSP):\n",
1054 "\n",
1055 "Functions that use references to base class objects must be able to use objects of derived classes without knowing it.\n",
1056 "\n",
1057 "In other words: an object (such as a class) may be replaced by a sub-object (such as a class that extends the first class) without breaking the program.\n"
1052 ] 1058 ]
1053 }, 1059 },
1054 { 1060 {