Singleton Overlaps?

<p>I have two classes using as singletons.</p><pre><br /><code>class Boss {<br /> static let sharedInstance = Boss()<br /> private init() {} <br /><br /> var user_id : String?<br /> var username : String?<br />}<br /><br /><br /><br />class Job {<br /> static let sharedInstance = Job()<br /> private init() {} <br /><br /> var job_id : String?<br /> var JobType : String?<br />}<br /></code><br /></pre><p>But after populating the <code>Boss.sharedInstance</code> first, <code>Job.sharedInstance</code> also containing Boss' class variables. But after replacing the <code>sharedInstance</code> with other name (for eg. <code>job_sharedInstance</code> and <code>boss_sharedInstance</code>) respectively, things are working fine. It's quite weird. Can anybody explain me the reason why it would happen like this. Thanks in advance.</p><br /><h2>Click here view more answers <a href="%20http://stackoverflow.com/questions/34525828/singleton-overlaps">http://ift.tt/1YSl1Zb</a></h2>

Nhận xét

Bài đăng phổ biến từ blog này

Align div to bottom of the page in bootstrap

Align elements inside an tag vertically

Javascript is unable to stop page loading