Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

private constructor in abstract classes

 
Minal Silimkar-Urankar
Ranch Hand
Posts: 136
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to create private constructor in abstract classes.
It is allowing.

What is the use of private condtructors in absract claases?
 
Kishore Kumar
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abstract class can have a private constructor. But that class cannot be extended by another class. Instead add a static inner class inside the abstact class and extend that abstract class.



This is a small sample code.
 
Minal Silimkar-Urankar
Ranch Hand
Posts: 136
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.

I got how I can use abstract class with private constructor.
Where we will use this type of constructors?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic