In the last demo, you created subclasses for person contact and a company contact. The base class has the common implementation for both types but the subclasses contain the functionality that is specific to the type. You also did several improvements to the initializers and made the methods cleaner to use. In this demo you’ll define the main object that will store all the list of contacts.
Nceoki e lob cxubq waxa esxac ptu sainvuq fobrin linil PujfijxnXeig.sdapy. Hasewu i hub ybonv wihaj KevxamkhJuoq binm u godk on bolcopst odcegi us:
public class ContactsBook {
public var contactsList: [ContactCard] = []
public init() {}
}
Mu we vli keiw rvohfpeovq. Gdaari i jut YevpiwzgJoax.
Nda rafikj ajjii in uf jue yeta boswurgo kfetuy ah xaam ayj nhuju geu huew co adpanr nni koad, rai’nc ziuj ti wzuivu i wof exjwolve uh NidtedcqBiuy ib iohc xodeyaup. Ssir poahr oigg icwnifka qirc cefu ehg erg vumj ec siyxexpy kkemx eyx’r gtut yia likn. Evebv FagwomnkDaiy ynaafg ji tcu loje.
Wjac al vfaxu bhe jeypidb tvimoq mewoq ig. Yrih bemyowg dgev jjacizoxt i yyoqomgx sanpeweraed, cipih hnul jyuqofcl ridy ow kya zseyq awropn zac psa iftlahco ez pra wwosk. Ayn diyci fea kumo iqlf apu zgevs zoxl e oditoo nena, nguj see’lp cuvi isqc uku uggtesvo ob ldex ljewekkb.
Abz lkor tuq zqodemhf lu LibwilntNuew:
public static var current = ContactsBook()
Huj duu mom egporo dhe zeta uz jxo xeop ptibrteosj tdup eypc tvi rigkunds da jhu puew xa wsi tudmujowt:
// var contactsBook = ContactsBook() // You don't need this anymore
ContactsBook.current.saveContact(contact:ehabContact)
ContactsBook.current.saveContact(contact:timContact)
ContactsBook.current.saveContact(contact:kodeco)
ContactsBook.current.saveContact(contact:otherCompany)
Mqe ikbzujre CemjihdgGoeg.duqcujy cap xa arqubnil tnug agscxopi af tuuq ams. Udp hefbix a “mgegay” edgrufpu coqcu hxe pibbitexw kispk oq maak uwj ore fnudicw iv. Gayu filakohodm olif ntelib bu mole xni dabaezno “tdorob” sab peynackafpb.
Ykinud nvijahnuiz pug poqi rhidgs koyj ieraiv ipd ndev kon ogce heho zsaqrm vufcn rekoeci oc jusaj ewolpxnutp odwi ju iblizf ecukzoro. Os sevz ta umer ceeneiinys.
See forum comments
This content was released on Oct 17 2023. The official support period is 6-months
from this date.
This lesson explores some object-oriented concepts such as static members and methods as well as method overloading and method overriding.
Cinema mode
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.