Please enable JavaScript.
Coggle requires JavaScript to display documents.
Inheritance (ClassLoader (load class info to method section in memory,…
Inheritance
ClassLoader
-
dynamic, only load when first time used
-
-
-
Pros
reuse code. share common code base of members, methods, constructors...
-
-
Dynamic Binding
invoke method of the actual type of instance in heap,
find in super class only if the method is not in child class
not efficient when looking up method in super classes from deep level of inheritance. Virtual method lookup table is used to optimize this.
-
Static Binding
if using handle of super class, will get super class values
-
instance variable, static variable, static method, private method are all static binding
Overload
if super and child method parameter types are both not perfect match, the closer one is used
check best matching version, then apply dynamic binding
-
-
Cons
can break encapsulation, override method have dependency on super method implementation
-