I searched ans in stackoverflow and google but didn't get what I needed.
What I'm looking for:
Is there a way to set default values for class properties for a class? Like what we can do in Java, in the constructor of the class e.g. -
MyClass(int a, String str){//constructor
this.a = a;
this.str = str;
// i am loking for similar way in obj-C as follows
this.x = a*5;
this.y = 'nothing';
}
Why am I looking for:
I have a class with 15 properties. When I create an instance of the class, I have to set all these variables / properties with some default values. Thus, this makes my code heavy as well as complicated. If I could set some default values for these instance variables from this class, this should reduce this code complexity / redundancy.
I need your help.
Thanks in advance for your help.
-Sadat