• Post Reply Bookmark Topic Watch Topic
  • New Topic

constructor  RSS feed

 
Nickk Singhal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we make constructor in abstract class??
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?
 
Randall Twede
Ranch Hand
Posts: 4696
8
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it?

a good reply. i have also posted questions when i could just try it and see.
the short answer is yes
 
Nickk Singhal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I have tried it..

but I want to knw the reason behind it..
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nickk Singhal wrote:yes, I have tried it..

but I want to knw the reason behind it..


Just because a class is abstract doesn't mean that the constructor won't be called. Hint... when you instantiate a class, does the class' super class constructor gets called? and what happens if the super class is abstract?

Henry
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nickk Singhal wrote:but I want to knw the reason behind it..

Then should not that have been the question you asked? Otherwise you are just wasting people's time with questions you already know the answer to.

Why do you think this should not be allowed?
 
Campbell Ritchie
Marshal
Posts: 56598
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... and welcome to the Ranch
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!