getters

Setter and getter not working

This is my assignment about setter and getter and it is not working for some reason. Could anyone check what the problem is for me? Thank you. public class FlightTest { public static void main (String [] args) { String name; String number; String Orig; String Desti; Scanner scan = new Sc...

is this C++ getter-like syntax wrong ?

Say i have the following class : class Abc { int id; public: int getID() { return id; } int setID(int id) { this->id = id; } }; Is there any logical error in this ? I seem to be getting unexpected results (read : wrong values of id). I know this is not the way to write a getter .. but still there shudn't be any err...

Difference between @interface definition in .h and .m file

Hi friends... Normally we use @interface interface_name : parent_class <delegates> { ...... } @end method in .h file and in .m file we synthesis the properties of variables declared in .h file. But in some code, this @interface.....@end method is kept in the .m file also. What it means? What is the difference between them? Also g...

Setters and Getters (Noobie) - iPhone SDK

Hello everyone, I don't really have a solid understanding of Setters and Getters for objective-c. Can someone provide a good guide for beginners? I noticed that this comes into play when trying to access variables in another class, which I am trying to do right now. I have two classes, lets say A and B. I have a NSString variable in A w...

Objective C ViewController with a C++ object as a property has getters and setters that re-initialise it every time it's referenced

I have tried so many combination's of code I don't have a sample to show. I have a Objective C view controller, and in the interface I declare a C++ class that contains the preferences of what the user wants to have. I do my @property command in the header and @synthesize command at the top of the .mm file. Then I use the class in the...

Wondering whether I should just bail on using properties in python

Hi, I have been trying to use properties instead of specific setters and getters in my app. They seem more pythonic and generally make my code more readable. More readable except for one issue: Typos. consider the following simple example (note, my properties actually do some processing even though the examples here just set or retu...