CSC/ECE 517 Fall 2011/ch6 6b ra: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 4: Line 4:
=='''Introduction'''==
=='''Introduction'''==
<p> Subclassing is one of the significant features of [http://en.wikipedia.org/wiki/Object-oriented_programming OO programming], which greatly increases the reusability of classes and also minimizes duplication of code. A subclass usually inherits some properties from a super class. [http://en.wikipedia.org/wiki/Inheritance Inheritance] is a design principle in object oriented languages like Java. The reason behind  inheritance is to reuse the code of existing objects or establish a subtype from an object. This greatly improves the efficiency and makes the code more readable as methods which are written only once can be used by a lot of subclasses. A superclass consists of common features that can be extended over subclasses. Superclass and subclass are commonly called base and derived class. The relationship between a subclass and superclass can be represented by a simple UML diagram as shown below.  
<p> Subclassing is one of the significant features of [http://en.wikipedia.org/wiki/Object-oriented_programming OO programming], which greatly increases the reusability of classes and also minimizes duplication of code. A subclass usually inherits some properties from a super class. [http://en.wikipedia.org/wiki/Inheritance Inheritance] is a design principle in object oriented languages like Java. The reason behind  inheritance is to reuse the code of existing objects or establish a subtype from an object. This greatly improves the efficiency and makes the code more readable as methods which are written only once can be used by a lot of subclasses. A superclass consists of common features that can be extended over subclasses. Superclass and subclass are commonly called base and derived class. The relationship between a subclass and superclass can be represented by a simple UML diagram as shown below.  
&nbsp; &nbsp; [[File:UML_Subclass.jpg]]
 
<br>[[File:UML_Subclass.jpg]]


==Conclusion==
==Conclusion==

Revision as of 23:22, 12 November 2011

Subclassing


Introduction

Subclassing is one of the significant features of OO programming, which greatly increases the reusability of classes and also minimizes duplication of code. A subclass usually inherits some properties from a super class. Inheritance is a design principle in object oriented languages like Java. The reason behind inheritance is to reuse the code of existing objects or establish a subtype from an object. This greatly improves the efficiency and makes the code more readable as methods which are written only once can be used by a lot of subclasses. A superclass consists of common features that can be extended over subclasses. Superclass and subclass are commonly called base and derived class. The relationship between a subclass and superclass can be represented by a simple UML diagram as shown below.

Conclusion

See also

External Links:

References: