Swift iOS Programming for Kids by Steffen D. Sommer & Jim Campagno
Author:Steffen D. Sommer & Jim Campagno [Sommer, Steffen D.]
Language: eng
Format: azw3
Publisher: Packt Publishing
Published: 2017-03-22T04:00:00+00:00
How cool is that? We just made two instances of a person communicate using the knowledge we acquired on OOP. In particular, note how the objects are communicating using the abstract Person type.
Adding more classes to the mix
Let's extend our program by introducing another class. We could add a Dog class to represent a dog that our persons are able to interact with. It could look something like this:
class Dog { var name: String var age: Int var breed: String init(name: String, age: Int, breed: String) { self.name = name self.age = age self.breed = breed } }
Very similar to our Person class, our new Dog class has the following properties:
name is the name of the dog
age is the age of the dog
breed is the breed of the dog
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6537)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6421)
Kotlin in Action by Dmitry Jemerov(5070)
Odoo 15 Development Essentials - Fifth Edition by Daniel Reis & Greg Mader(3375)
Odoo 15 Development Essentials by Daniel Reis(2816)
React Native - Building Mobile Apps with JavaScript by Novick Vladimir(2534)
Learning Angular - Second Edition by Christoffer Noring(2362)
Pride and Prejudice by Jane Austen(2351)
Mobile Forensics Cookbook by Igor Mikhaylov(2022)
Computers For Seniors For Dummies by Nancy C. Muir(2003)
Bulletproof Android: Practical Advice for Building Secure Apps (Developer's Library) by Godfrey Nolan(1875)
Android Development with Kotlin by Marcin Moskala & Igor Wojda(1801)
Building Android UIs with Custom Views by Raimon Ràfols Montané(1793)
1936941139 (N) by Bob Rosenthal(1734)
Building Progressive Web Apps: Bringing the Power of Native to the Browser by Ater Tal(1728)
Hands-On Internet of Things with MQTT by Tim Pulver(1710)
Android App Development by Franceschi Hervé J.;(1709)
Ember.js in Action by Joachim Haagen Skeie(1691)
Hands-On Design Patterns with React Native by Mateusz Grzesiukiewicz(1658)
