What is factory methods ? What is the advantage of using it ?



What is factory methods ? What is the advantage of using it ?..

Answer / babu

Class factory methods are implemented by a class as a convenience for developers. These methods combine allocation and initialisation in a single step and return the created object.

NSDate:

Eg: + (id)dataWithBytes:(const void *)bytes length:(unsigned)length;

NSDictionary

Eg:+ (instancetype)dictionary;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Apple iOS Interview Questions

What is nsobject in ios?

1 Answers  


Why we use delegate in ios?

1 Answers  


In a single model, can I have few entities in one sqlite db file and remaining in another sqlite db file?

0 Answers  


When was ios invented?

1 Answers  


What is weak and strong in ios?

1 Answers  


What does static analyser do?

1 Answers  


How can mobile application errors be prevented?

1 Answers  


How is the app delegate is declared by Xcode project templates?

1 Answers  


What is messaging? How does the runtime handle message passing? What is message forwarding?

1 Answers  


Why do all model object attributes get marked with @dynamic and not synthesised? What does @dynamic mean?

0 Answers  


What is the difference between atomic and non-atomic properties? Which is the default for synthesized properties? When would you use one over the other?

1 Answers  


Define 'strong' keyword?

1 Answers  


Categories