Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
service
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
Freenet DSL
Who's Online
9 user(s) are online (7 user(s) are browsing encyclopedia)

Members: 0
Guests: 9

more...
partner

Subclass (computer science)

In object-oriented programming, a subclass is a class (computer science) that Inheritance (computer science) some properties from its superclass (computer science).

You can usually think of the subclass as being a kind of its superclass, as in a a Manx (cat) is a kind of cat , or a square is a kind of rectangle :

*A cat has fur, four legs, and a tail **A Manx cat does not have a tail, but has all of the other characteristics listed above *A rectangle has four sides with lengths w and h **A square has all of the characteristics of a rectangle; in addition, w = h

In this way, a subclass is a more specific version of its superclass; that is, the facts about the cat state what is generally true for all cats, even if some kinds of cats happen to have no tail. And while all rectangles have four sides, the square has the more restricted feature that all of its sides have the same length.

Don t confuse the subclass-superclass relationship with that of classes and instances. An instance of cat refers to one particular cat . The manx cat in the table is still a class there are many instances of manx cats. And if a particular cat (an instance of the cat class) happen to have its tail bitten off by a fox, that does not change the cat class. It s just that particular cat that has changed.

Some software manuals refer to subclasses as derived classes .

=See also=

For a more in-depth explanation of the concept of classes in object-oriented programming, see class (computer science), in particular the section about class (computer science)#Subclasses and Superclasses on that page.