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

preventing subclassing

 
sheril she
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to prevent a class from being subclassed without using final keyword
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make all the constructors private and give clients a factory method to create instances...
Why don't you want to use "final"?
 
Sean Sullivan
Ranch Hand
Posts: 427
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public Foo
{
private Foo()
{
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic