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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is App Bundle in iOS operating system?

509


What is difference between atomic and nonatomic in ios?

395


An app is loaded into memory but is not executing any code. In which state will it be in?

459


What is ios appdelegate?

451


Which object is create by uiapplicationmain function at app launch time?

445






What is a category and when is it used?

506


How can mobile application errors be prevented?

440


What is singleton design pattern in ios?

456


what are the source items used by Xcode?

684


What are the important delegate methods of nsxml parser?

488


What are all the difference between categories and subclasses in iOS operating system?

431


What is the responder chain?

453


What is encapsulation in ios?

426


So how is the new look different from the old look?

405


Explain stack and heap?

504