Must call a designated initializer of the superclass

  • 即係講到尾, subclass 想 call super.init 唔可以 call 佢個d convenience 只能 call 基本 init
  • 基本 init 又可以有好多個 , 你要 superclass 佢, 就要 required 晒佢~

    class NoteMessage: Message { let content: String
    
        init(content: String, theUser: String)
        {
            self.content = content
            super.init(sender: theUser)
            //Error!:  Must call a designated initializer of the superclass 'Message'
        }
    }
    

enter image description here