CSC/ECE 517 Spring 2013/ch1a 1e pi: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
<Index>
<Index>


Means of achieving inheritance  
=== Means of achieving inheritance ===
In classical inheritance where objects are defined by classes, classes can inherit attributes and behavior from pre-existing classes called base classes, superclasses, or parent classes. The resulting classes are known as derived classes, subclasses, or child classes. The relationships of classes through inheritance gives rise to a hierarchy.  
'''Classical Inheritance'''
Objects are defined by classes, classes can inherit attributes and behavior from pre-existing classes called base classes, superclasses, or parent classes. The resulting classes are known as derived classes, subclasses, or child classes. The relationships of classes through inheritance gives rise to a hierarchy.  


[[File:Inheritance(Classical Inheritance).png]]
[[File:Inheritance(Classical Inheritance).png]]
'''Prototype Based Inheritance'''
A feature of object-oriented programming  in which classes  are not present and inheritance is  performed via a process of [http://en.wikipedia.org/wiki/Cloning_(programming) cloning] existing objects that serve as [http://en.wikipedia.org/wiki/Prototype prototypes] .   [http://en.wikipedia.org/wiki/Delegation_(programming) Delegation] is the language feature that supports prototype-based programming.
==References==
<references/>
1. [http://en.wikipedia.org/wiki/Prototype-based_programming]
2. [http://en.wikipedia.org/wiki/Delegation_(programming)]
3. [http://en.wikipedia.org/wiki/Cloning_(programming)]

Revision as of 14:34, 8 February 2013

Inheritance

In object-oriented programming (OOP), inheritance is a way to reuse code of existing objects, or to establish a subtype from an existing object, or both

<Index>

Means of achieving inheritance

Classical Inheritance Objects are defined by classes, classes can inherit attributes and behavior from pre-existing classes called base classes, superclasses, or parent classes. The resulting classes are known as derived classes, subclasses, or child classes. The relationships of classes through inheritance gives rise to a hierarchy.

Prototype Based Inheritance A feature of object-oriented programming in which classes are not present and inheritance is performed via a process of cloning existing objects that serve as prototypes .  Delegation is the language feature that supports prototype-based programming.





References

<references/>

1. [1]

2. [2]

3. [3]