0

I want to wrap an object in Objective c, so that user can't initialise or change any parameter.

For example,

I am building restaurantManager module. So after initialisation user will call [restaurantManagerObject searchforAvailableDrink] which is a async call. It will invoke restaurantManager delegate didDrinkAvailable:(Drink*)drink.

I will create drink from lower layer and send it to the delegate. To do that I need to initialise Drink object and set the desired attributes to drink from another internal class.

But I don't want to make those APIs visible to the header. User will only get a ready made drink object where he can use some attributes and public methods.

How to do that ?

Sid Mhatre
  • 3,272
  • 1
  • 19
  • 38
taserghar
  • 340
  • 3
  • 15
  • 2
    You could have two header files. One public, one private. – Thilo Mar 07 '17 at 03:03
  • @Thilo, Could you please give me an example, how to make two headers for single class ? – taserghar Mar 07 '17 at 03:05
  • 1
    Maybe this? http://stackoverflow.com/a/647104/14955 http://stackoverflow.com/questions/19095716/hiding-properties-from-public-framework-headers-but-leaving-available-internall – Thilo Mar 07 '17 at 03:08
  • Perhaps take a look at http://stackoverflow.com/a/651422/115865 – nikkumang Mar 07 '17 at 04:02

0 Answers0