problem about abstract-type-Collection of common programming errors


  • Adrian
    scala abstract-class abstract-type
    I want to define a constructor in an abstract class that will create concrete subclasses.abstract class A {type Impl <: Adef construct() : Impl = {val res = new Impl() //compile error: class type required but A.this.Impl found// do more initialization with res} }class B extends A {type Impl = B} class C extends A {type Impl = C} //… val b = new B b.construct() // this should create a new instance of BWhat is wrong here? Is this even possible to implement? EDIT: Clarification: I want to abst

Web site is in building