I.T. Discussion Community!
-Collapse +Expand
Coder
Search Coder Group:

Advanced
-Collapse +Expand Coder Study Test
PRESTWOODCERTIFIED
-Collapse +Expand Coder Store
PRESTWOODSTORE

Prestwood eMagazine

May Edition
Subscribe now! It's Free!
Enter your email:

   ► KBRole-Based T...Coding & OOObject Orien...   Print This     
  From the February 2016 Issue of Prestwood eMag
 
Coder Object Orientation (OO):
Abstract Class / Abstract Member
 
Posted 11 years ago on 1/23/2008 and updated 3/8/2009
Take Away:

An abstract class member is a member that is specified in a class but not implemented. Classes that inherit from the class will have to implement the abstract member. Abstract members are a technique for ensuring a common interface with descendant classes. An abstract class is a class you cannot instantiate. A pure abstract class is a class with only abstract members.

Coder Definition Flashcard:
 A flashcard from our Coder Flashcards Library
 A definition from our Coder Definitions Page

KB100811



Abstract Class / Abstract Member -

An abstract class member is a member that is specified in a class but not implemented. Classes that inherit from the class will have to implement the abstract member. Abstract members are a technique for ensuring a common interface with descendant classes. An abstract class is a class you cannot instantiate. A pure abstract class is a class with only abstract members.


UML Definition

In UML terms, you would probably use different words oriented toward analysis. One might define an abstract class as a "Reusable OO design for a component. Specifies the interface of a class and the tree of subclasses that can be derived from it. Specify behavior (not implementation). A class intended to be used by sub-typing, for the behavior it describes rather than by having instances."

Abstract Classes and Interfaces are Similar Concepts

Interfaces and abstract classes are similar concepts. In a class tree, inheritance, including abstract classes and members, is used to design classes vertically. You add functionality from top to bottom adding methods and properties to descendant classes. Interfaces allow you to design horizontally across your class tree. Interfaces allow you to enforce a common interface horizontally and/or randomly in your class tree. Abstract classes allow you to enforce a common interface vertically from the abstract class down.

Plato's Universal

Sometimes programmers refer to an abstract class as a universal which dates back to about 400 BC to Plato and his theory of Forms. For example, a beautiful rose is a copy or imitation of a rose template (or class) and implemented the universal Forms flowerness and beauty. The theory of forms was his way of explaining how the same universal term can refer to so many particular things or events. The beauty form (either an abstract class or an interface in programming), for example, can be applied to hundreds of particular things because these things have something in common, their resemblance to, or participation in, the Form beauty. An object is beautiful to the extent that it participates in the Idea, or Form, of beauty.

Everything in the world of space and time is what it is by virtue of its resemblance to, or participation in, its universal Form. The ability to define the universal term is evidence that one has grasped the Form to which that universal refers. Plato conceived the Forms as arranged hierarchically; the supreme Form is the Form of the Good (his base-class). As a programmer, you can think of your problem domain, your application, as a set of objects. You can practice Plato's Forms using inheritance, abstract classes, and interfaces. Understanding Plato's theory of Forms can help you with the concept of abstraction in your own application.

Abstract Versus Concrete

You can think of a concrete method as the fullfillment of an abstract method and you can think of a concrete class as the fulfillment of an abstract class. However, a concrete member or class is really just an implemented member or class. The abstraction of a member or class is always there even when it's not there in code. In your code, abstraction is either implied or explicit. The abstraction is implicit (only in design) for regular and virtual methods and it's explicit when you code an abstract class or method or an interface -- an interface is a type of abstraction.

In general, a concrete class is a class where all the members are implemented and the class can be instantiated. Any class with one or more abstract members is not a concrete class.

More Info

Code:  C# Abstraction (abstract, override)
Code:  C++ Abstraction (=0 in a virtual method)
Code:  Delphi Abstraction (abstract, override)
Code:  Delphi Prism Abstraction (abstract, override)
Code:  Java Abstraction (abstract)
Code:  VB.Net Abstraction (MustInherit, MustOverride, Overrides)

Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1235A1
Enter key:
Definition Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #100811 Counter
20664
Since 4/2/2008
Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech