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 are transient properties?

657


What is delegate method?

593


Explain your process for tracing and fixing a memory leak iOs?

651


How to find the memory leaks in mrc?

1020


What is meaning of 'assign' keyword?

693


What is the difference between strong and retain.

555


Explain interfaces?

660


What is retain counts?

572


What is the ? In swift?

645


What is called before viewdidload?

616


Explain formal protocols?

621


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

568


What is mvvm in ios?

680


Explain what is garbage collection?

625


Define 'atomic' keyword?

579