Results 1 to 6 of 6
  1. #1
    scott is offline Member
    Join Date
    Feb 2010
    Posts
    1
    Rep Power
    0

    Thumbs down Purpose of abstract class

    What is the purpose of abstract class?

  2. #2
    SharadSilicon is offline Member
    Join Date
    Feb 2010
    Posts
    1
    Rep Power
    0

    Thumbs down Purpose of abstract class

    It is not an instantiable class. It provides the concrete implementation for some/all the methods. So that they can reuse the concrete functionality by inheriting the abstract class.For more information about Purpose of abstract class go to the following link below java developer course

  3. #3
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    5

    Default

    abstract class is a class where it has implemented and non-implemented methods.
    This is kinda similar to interface but in this case the inherited class can reuse the abstract classe's concrete methods as well as implement the non-implemented methods.

    Thus reducing the amount of work by typing redundant methods over and over again.

    Thats one of its uses.

  4. #4
    Aseem is offline Senior Member
    Join Date
    Mar 2009
    Location
    USA
    Posts
    127
    Rep Power
    0

    Default

    Inheritance.

  5. #5
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by scott View Post
    What is the purpose of abstract class?
    Its purpose is to be extended.

  6. #6
    devaru2003 is offline Member
    Join Date
    Mar 2010
    Posts
    6
    Rep Power
    0

    Default

    The main purpose of Abstract class is polymorphism
    The abstract class should represent a concept and provide all interfaces necessary to represent that concept. Each derived class will have its own implementation of the concept. However client will never know / or not required to know about implementation of actual implementation. what all he cares about the abstract concept.

    There is an alternative to abstract class i.e. Interface. Interface should be used when you want to define purely interface, no concrete implementation of any method. Interface acts as Facade so basically you can use it to define different level of interfaces to different client using different Interfaces with same implementation.
    e.g. A class can cook Classic pizza, Butter Pizza and special Pizzza.
    Pizza shop has distributed some coupon for advertisement, and the coupon get you classic pizza free.
    I can create a interface which exposes only cooking classic pizza interface, securing my other pizzas against free coupon policy.

Similar Threads

  1. abstract class help
    By jhering1986 in forum New To Java
    Replies: 2
    Last Post: 03-25-2009, 08:18 AM
  2. Replies: 6
    Last Post: 02-11-2009, 10:51 AM
  3. Abstract class
    By naeem.jamil in forum New To Java
    Replies: 4
    Last Post: 08-26-2008, 05:21 AM
  4. Replies: 0
    Last Post: 04-02-2008, 07:04 AM
  5. Abstract Class
    By gapper in forum New To Java
    Replies: 4
    Last Post: 01-31-2008, 01:25 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •