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 lazy loading?

1 Answers  


What is cocoa and cocoa touch?

0 Answers  


What is a view controller in ios?

0 Answers  


What is iphone sdk?

0 Answers  


Would I be able to keep in touch with some c++ work in the equivalent .m record? Will it compile? Assuming no, what changes would it be a good idea for me to do to compile it?

0 Answers  


How to de-symbolicate crash log?

0 Answers  


Can we support the same application for iphone 3gs and iphone 5, 6, 7? Why not?

0 Answers  


What is latest mac os version?

0 Answers  


What language is ios written in?

0 Answers  


Explain what is storyboard?

0 Answers  


Explain difference between coredata & sqlite?

0 Answers  


Explain about design patterns in iOS

1 Answers  


Categories