Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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