Created
July 6, 2012 02:01
-
-
Save matthandlersux/3057591 to your computer and use it in GitHub Desktop.
any way to make this cleaner?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class SuperClass { | |
var initialized = false | |
def initialize { | |
initialized = true | |
} | |
} | |
abstract trait SubclassCompanion { | |
def create:Any | |
} | |
object Subclass1 extends SuperClass with SubclassCompanion { | |
def create { | |
val obj = new Subclass1() | |
obj.initialize | |
obj | |
} | |
} | |
class Subclass1 extends SuperClass { | |
} | |
object Subclass2 extends SuperClass with SubclassCompanion { | |
def create { | |
val obj = new Subclass2() | |
obj.initialize | |
obj | |
} | |
} | |
class Subclass2 extends SuperClass { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment