Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C# Programming

C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-23-2006, 08:50 PM
Chan Chan is offline
Programming Professional
 
Join Date: Jun 2006
Posts: 204
Rep Power: 9
Chan is on a distinguished road
Default 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-24-2006, 06:08 AM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 10
brackett is on a distinguished road
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-24-2006, 10:06 PM
Kaabi's Avatar   
Kaabi Kaabi is offline
Programming God
 
Join Date: Jul 2006
Posts: 884
Rep Power: 13
Kaabi is on a distinguished road
Default

Yes... Java is cleaner than C++ in some cases. >>... <<...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-25-2006, 11:44 AM
NeedHelp NeedHelp is offline
Programming God
 
Join Date: May 2006
Posts: 527
Rep Power: 12
NeedHelp is on a distinguished road
Default

You need these for properties, not functions. You have it wrong.
__________________
I Need Help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 11:39 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 66%

Ads