1 Replies - 2643 Views - Last Post: 20 July 2013 - 07:41 AM

#1 Zag  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 20-July 13

Noob: Object needed?

Posted 20 July 2013 - 05:35 AM

Hi!

I'm an absolute noob. Got an absolute noob question about Objective-C:

If I create a class that I know will have just one instance in any program, do i still need to create an object from it?

Basically, if only one instance is needed, can't I use the class directly (in main routine just call class methods, etc.)


Thanks in advance!

Zag
Is This A Good Question/Topic? 0
  • +

Replies To: Noob: Object needed?

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10364
  • View blog
  • Posts: 38,368
  • Joined: 27-December 08

Re: Noob: Object needed?

Posted 20 July 2013 - 07:41 AM

I'd definitely say adhere to good OO principles. You may end up needing another instance as you delve deeper into developing your app. I would suggest reading up on the Singleton pattern to see if that better suits your needs.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1