Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Object-Oriented Swift 2.0 Class Inheritance Overriding Methods

everything works fine on xcode and i have done what is mentioned in the task exactly the same can anyone help me please

i think that there is something wrong in the texteditor

class Person {
    let firstName: String
    let lastName: String

    init(firstName: String, lastName: String) {
        self.firstName = firstName
        self.lastName = lastName

    func getFullName() -> String {
        return "\(firstName) \(lastName)"
class Doctor : Person {
    override init(firstName: String, lastName: String) {
        super.init(firstName: firstName , lastName: lastName)

    override func getFullName() -> String {
        return " Dr.\(lastName)"
Person.init(firstName : "Sam" , LastName : "Smith" ).getFullName()
 let  someDoctor = Doctor.init(firstName: "Sam" , lastName: "Smith").getFullName()

The lastName argument when you init Person has a typo. Use a lowercase "L" "l"

Ettaghouti Mouad
Ettaghouti Mouad
2,195 Points

Place this line: let someDoctor = Doctor(firstName: "Dr", lastName: "Smith") Instead this line: let someDoctor = Doctor.init(firstName: "Sam" , lastName: "Smith").getFullName()

For me it work.

thanks Ettaghouti Mouad ... are you arabic ?

2 Answers

hhhh welcome ena abderrahim from tunisia this is my FB : Abderrahim gdah

Ettaghouti Mouad
Ettaghouti Mouad
2,195 Points

I'am in France but i'am tunisia too