There may be a way this may work:
class A { private func foo() { println("A: Foo") } final func bar() { println("A: Bar") foo() } } class B : A { override private func foo() { println("B: foo") } } var a = A() a.bar()
This code forbids overriding the bar() method, but allows you to override the foo() method. Then the trick is that the user needs to call the bar() method instead of the foo() method, but if you do, then you will make sure that the superclass method is always used, i.e. println("A: Bar") !: -)
source share