clang - Swift: declaration 'description' cannot override more than one superclass declaration -


i have structure of inheritance similar 1 below. i'm adopting printable protocol , diligently override description property. have encountered bizarre error seems unknown google @ point in time, prompted third class, , references second , first class.

to add insult injury, code below compiles fine, full code not. commenting properties out on second , third solves problem , code compiles, tests pass etc.

swift inheritance chapter provides pointers this.

does know means , circumstances trigger it?

/users/ivanhoe/dropbox/swift/convergence/processable.swift:124:18: error: declaration 'description' cannot override more 1 superclass declaration override var description : string { ^ /users/ivanhoe/dropbox/swift/convergence/processable.swift:85:18: note: overridden declaration here override var description : string { ^ /users/ivanhoe/dropbox/swift/convergence/processable.swift:28:18: note: overridden declaration here override var description : string {

import foundation  class first : nsobject, printable {      override var description : string {         return "first"     } }  class second : first {      override var description : string {         return "second"     }  }  class third : second {      override var description : string {         return "third"     }  }  println(third()) 

same problem me, solved doing:

func customdescription() -> string {     return "" }  override var description: string {     return customdescription() } 

so can override function many times want to


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -