In this Intermediate Swift 3 video tutorial you'll learn how to build on existing types through the use of Inheritance.
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3536-intermediate-swift-3/lessons/6
In this Intermediate Swift 3 video tutorial you'll learn how to build on existing types through the use of Inheritance.
Hey there - the challenge file is labeled “BeginningSwift_InheritanceChallenge.playground” but when I open the file itself, it says it’s for Initializers and not Inheritance. At the end of the video you mentioned the challenge was going to be dealing with creating classes/structs for Animals, etc. But I didn’t see that anywhere in the download materials for any of the courses.
Also, as an FYI - within the materials.zip file, the demo playground is labeled as “InitializersDemo.playground” even though it’s for Inheritance.
Thanks,
Michael
Let’s say I need to inherit from a struct:
struct Book {
func addPage() {
print("i am a book")
}
}
struct SuperBook : Book {
}
And I got this error:
Playground execution failed: error: MyPlayground.playground:5:8: error: inheritance from non-protocol type 'Book'
struct SuperBook : Book {
^
What should I do to inherit from a struct?
Noticed this too Michael - its now June 2017 - file still has not been updated. However, the challenge is an inheritance example - just with bank accounts instead of animals. Yes - I would have preferred animas too