From 80da24887ac760a9d18936634d8d46c0643521ee Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Sun, 23 Jul 2023 09:12:03 -0700 Subject: add a lot of mindmap articles --- mindmap/inheritance.org | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 mindmap/inheritance.org (limited to 'mindmap/inheritance.org') diff --git a/mindmap/inheritance.org b/mindmap/inheritance.org new file mode 100644 index 0000000..dc3f21d --- /dev/null +++ b/mindmap/inheritance.org @@ -0,0 +1,24 @@ +:PROPERTIES: +:ID: 4ed61028-811e-4425-b956-feca6ee92ba1 +:END: +#+title: inheritance +#+author: Preston Pan +#+html_head: +#+html_head: +#+html_head: +#+options: broken-links:t + +* Definition +In programming, inheritance is the adoption of attributes of a child class by that of a parent class. +For instance, in this example: +#+begin_src python :results output both +class Animal: + def __init__(self, birthday): + self.weight = weight + self.birthday = birthday + +class Dog(Animal): + pass +#+end_src +The class ~~Dog~~ will have the same fields as that of animal. In general, you can think of inheritance as +taking on attributes from a node higher in the abstraction hierarchy. -- cgit