#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Using Accessors Help?


    I have an accessor called "getRate" and need to use it in order to give a double called "rate" a value. The double is in a separate file and im not sure how to go about using accessors. Could anyone help me out with this? Thanks in advance.
  2. #2
  3. Daniel Schildsky
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2004
    Location
    KL, Malaysia.
    Posts
    1,553
    Rep Power
    1621
    If the double is a static class member, you can access it directly by <className>.<variable name>, provided that the class member is public.

    However, if the double is an instance variable, you must first instantiate an instance of the containing class, initialise or perform some processing to assign a double value to your instance variable, then access it from another class using the accessor <instance name>.get<variable name>(), where <variable name> would normally be the name of the double instance variable.
    When the programming world turns decent, the real world will turn upside down.

IMN logo majestic logo threadwatch logo seochat tools logo