This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

abstract class extends abstract class!  RSS feed

 
Jyoti Vaskar
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

what if an abstract class extends abstract class???
Has it to inherit all the methods of it's abstact super class??

Kindly explain.
 
Swastik Dey
Rancher
Posts: 1782
14
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not required because you are declaring the child class itself as abstract.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has it to inherit all the methods of it's abstact super class??


They are automatically inherited. You will have to implement the abstract methods that are inherited
 
Dejan Miler
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the example



1.The abstract class Dog can but do not need to implement astract makeASound method from his superclass Animal
2.The regular class Rottweiler must implements all abstract methods form his super class/classes (Animal class and Dog class).

Dejan.


 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.out.println("Auuuuuuuuu");


What kind of a dog says Auuuuuuuuu ? Is he hurt ?

 
Haresh Panjwani
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the methods of the abstract super class are inherited and you only need to implement those inherited methods
 
Dejan Miler
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My dog yowl like a wolf .
It is good thing to keep me awake at night to lean for SCJP.

Dejan
 
Santiago Ennis
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here, the concrete class Rottweiler does not need to implement makeASound(), as it was already implemented by its direct superclass Dog. But it is mandatory for Rottweiler class to implement command() method.




My first post, btw.


- SE
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch Santiago
 
Dejan Miler
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome Ranch Santiago.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to javaranch, Haresh and Santiago
 
Jyoti Vaskar
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you everybody for replying on my post.

Also welcome Haresh & Santiago.
You both started from my post .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!