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’s the difference between mkannotation and mkpointannotation?

728


Which compiler is used by ios? : IOS Architect

658


Define content offset?

639


Explain the difference between 'protocol' and 'delegate'?

575


What is viper code?

590


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

689


What does ios mean on my iphone?

659


What does ios stand for apple?

584


Explain alamofire benefits

594


How can you enable client certificate in ios 12? : IOS Architect

578


Explain about Viewcontroller lifecycle.

631


What's the latest version of ios?

665


Is viewdidload only called once?

610


How is retain different from assign?

587


Is react native easy?

558