Python Forum
inheritence vs instanciation?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
inheritence vs instanciation?
#1
what is the different between inheritence and instanciation?
They both have same function and uses.
so how are the two used differently?
Reply
#2
(Feb-18-2017, 04:31 AM)hsunteik Wrote: what is the different between inheritence and instanciation?
They both have same function and uses.
so how are the two used differently?

Totally different things.

"inheritance" is defining a new class by modifying/specializing the "base" class. For instance you have a  class Mammal, from which you derive a class Dog, from which you derive a class Labrador. So Labrador inherits from Dog which inherits from Mammal.

"instanciation" is creating objects ("instances") of the class. Instances of Labrador are called "Fido", "Snoopy", etc... Note that Fido, is a Labrador, but is also a Dog and a Mammal, so methods defined for Mammal are also available for Dog and Labrador (but of course these class can override said methods to provide their own).
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  inheritence overrides NobahdiAtoll 5 3,096 Aug-25-2018, 11:50 AM
Last Post: NobahdiAtoll

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020