Closed Thread
Results 1 to 4 of 4

Thread: Get and Set Functions

  1. #1
    Chan is offline Programming Professional
    Join Date
    Jun 2006
    Posts
    205
    Rep Power
    0

    Get and Set Functions

    I don't really understand the GET and SET functions inside of a function. The functions go like this:

    Code:
    int somefunction() {
    Get {
       return variable;
    }
    
    set {
       variable = this;
    }
    }
    Where do you send the variable for set? When was this added? It seems like a neat way to create functions in classes and not have to create a new get/set function for everything.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    I think you're describing Properties, but the syntax is a bit off. Instead of function someFunction, it'd be property someProperty.

    The value in the set is implicit - it's what gets passed when you say object.someProperty = x; (x is the passed value).

    It's cleaner than Java's getProperty, setProperty IMHO.

  4. #3
    Kaabi Guest
    Yes... Java is cleaner than C++ in some cases. >>... <<...

  5. #4
    NeedHelp Guest
    You need these for properties, not functions. You have it wrong.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. using functions.
    By apejam in forum Python
    Replies: 2
    Last Post: 10-25-2011, 09:13 PM
  2. Replies: 4
    Last Post: 02-06-2011, 01:37 PM
  3. c# and api functions
    By Computer Engineer in forum C# Programming
    Replies: 6
    Last Post: 05-28-2010, 06:56 AM
  4. SQL Functions - SQL Encryption Functions
    By chili5 in forum Tutorials
    Replies: 8
    Last Post: 09-04-2009, 09:40 AM
  5. SQL Functions - Math Functions
    By chili5 in forum Tutorials
    Replies: 6
    Last Post: 09-02-2009, 02:11 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts