Page 199

Swift

super.init(physics: physics) } }

let sa = [ Chemistry(physics: "solid physics", equations: "Hertz"), Maths(physics: "Fluid Dynamics", formulae: "Giga Hertz"), Chemistry(physics: "Thermo physics", equations: "Decibels"), Maths(physics: "Astro Physics", formulae: "MegaHertz"), Maths(physics: "Differential Equations", formulae: "Cosine Series")]

let samplechem = Chemistry(physics: "solid physics", equations: "Hertz") println("Instance physics is: \(samplechem.physics)") println("Instance equation is: \(samplechem.equations)")

let samplemaths = Maths(physics: "Fluid Dynamics", formulae: "Giga Hertz") println("Instance physics is: \(samplemaths.physics)") println("Instance formulae is: \(samplemaths.formulae)")

var chemCount = 0 var mathsCount = 0

for item in sa { if let print = item as? Chemistry { println("Chemistry topics are: '\(print.physics)', \(print.equations)") } else if let example = item as? Maths { println("Maths topics are: '\(example.physics)',

\(example.formulae)")

} }

var exampleany = [Any]()

exampleany.append(12) 187

​Quick is a strong and intuitive development language for macOS, iOS, watchOS and tvOS....  

...

Advertisement