I've started to learn swift a couple days ago and i come from a java/c++ background. However this piece of a code has a mistake that i cant seem to be able to fix.
class Student
{
var number:Int
var name:String
var course:String
init(_ name:String,_ number:Int, _ course:String)
{
self.number = number
self.name = name
self.course = course
}
func write()
{
print("Name:",self.name)
print("Number:",self.number)
print("Course:",self.course)
}
}
class ExchangeStudent:Student
{
var country:String
init(_ name:String,_ number:Int, _ course:String, _country:String)
{
super.init(name,number,course)
self.country = country
}
}
However i get the following error:
property 'self.country' not initialized at super.init call
And i don't really understand how i can solve it