Jump to content
Xtreme .Net Talk

C# Question: static int amountopen = (0 - 500); ???


Recommended Posts

Posted

Hi there,

 

I had some questions. I was learning c# and i saw this code:

 

static int amountopen = (0 - 500);

 

Hmm.. wonder, does it means we are setting a scope from 0 to 500 for integer amountopen?

 

This is first time i seen.

 

Oh ya, another added question. How does virtual keyword comes in handy in c# programming? Any good samples and explanations on that please.

 

Thanks.

 

Regards,

Chua Wen Ching :p

  • *Experts*
Posted

Looks like you're setting an int to -500... 0-500 is just zero subtract 500... -500.

 

And a virtual class means a class that must only be inherited and cannot be used on its own. (example: a PrimaryColor class that you inherit RedColor, BlueColor and GreenColor from, but don't want PrimaryColor itself being used).

Posted

Oh thanks.

 

So actually amountopen = -500

 

so actually why can't the coder place -500 at the first place but (0-500)? There must be a reason right?

 

Oh so virtual is used for that. Thanks a lot. :)

 

Anyway do you know which tutorial in c# which i can learn good oop design? I hope that tutorials utilizes oop concept in a better way. Any help? Thanks :)

 

Regards,

Chua Wen Ching :p

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...