Abstract Superclass

There is no object of Abstract class because it is abstract. For example, the class of Animal can be a abstract superclass, which means there is at least one abstract method (function) in the Animal class.

abstract class Animal{
private int itsAge;
public int getAge() {
return itsAge;
}
public abstract void move(); //abstract function
}

Because Animal is abstract class, you cannot do this:

Animal a = new Animal (); //Animal is abstract; cannot be instantiated
In the other word, object can only exist when the class is conrete class. You can derived the Cat class from Animal Class, and implement the move method, then you can do this:

Animal a = new Cat (); //object of Cat is also the object of Animal;

About these ads

6 Responses to “Abstract Superclass”

  1. Boy George Says:

    Oh wait. Yes, I have. I’m sorry, but I just don’t have it in me right now to type it all out again. Besides, it was just ramblings anyway. You didn’t want to hear me go on and on about this, right?

  2. Dana Says:

    Thank you !!! I was having a problem regarding this topic :)

  3. Nasir Mehmood Says:

    Thanx! But still give some more detail.

  4. Curtsy Says:

    Somehow i missed the point. Probably lost in translation :) Anyway … nice blog to visit.

    cheers, Curtsy.

  5. ads Says:

    succinct but some addition shall be even greater. like cat class :)

  6. Johna992 Says:

    Enjoyed studying this, very good stuff, regards . A man may learn wisdom even from a foe. by Aristophanes. kekcedddcbee

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: