For some people this page may be of use to help them get started, it helped me.
http://www.functionx.com/csharp/
C# Workshop - Week 1 (Ch. 1 & 2) - Advanced
Quote: Original post by TheTroll
The main use of the static constructor is to initialize static members of your class.
*** Source Snippet Removed ***
Hope that explains it.
theTroll
Ah, I see, it was as simple as that. Isn't it possible though to give the static members a value on declaration?
Quote: Original post by passwordQuote: Original post by TheTroll
The main use of the static constructor is to initialize static members of your class.
*** Source Snippet Removed ***
Hope that explains it.
theTroll
Ah, I see, it was as simple as that. Isn't it possible though to give the static members a value on declaration?
public class K{ private int static SOME_CONSTANT = 5;}
is indeed valid code. The static constructor is provided for the times you need to do something a bit more complex than that. See 10.4.5.
Yes you can declare a static in the declaration. What the static constructors are for is for more complex declaration. Say you need some information from the person's computer, screen size or the such and you are going to be storing that in a static. You then will need to use the static constructor.
I made a simple example so not to confuse people, what I showed would be just as easy to do in the declaration.
theTroll
I made a simple example so not to confuse people, what I showed would be just as easy to do in the declaration.
theTroll
I have been trying to create a game design to apply the concepts learned so far, but i don't know what should be created with what. where should classes be used, or properties. What concepts should be private and which ones should be public. Any suggestions?
here
here
![Image Hosted by ImageShack.us](http://img69.imageshack.us/img69/6263/acientarmygameconceptvc6.jpg)
[opinion]
Experience is the best teacher for the art which is program design. As a beginner, focus on making it work. You'll learn soon enough what design patterns tend to be good, which tend to be bad, and why. And you'll learn far better the nuances and 'feel' to it which don't tend to come along with rote instruction.
[/opinion]
That is also perhaps beyond the scope of these two chapters.
Experience is the best teacher for the art which is program design. As a beginner, focus on making it work. You'll learn soon enough what design patterns tend to be good, which tend to be bad, and why. And you'll learn far better the nuances and 'feel' to it which don't tend to come along with rote instruction.
[/opinion]
That is also perhaps beyond the scope of these two chapters.
Quote: Original post by alvarofrank
I have been trying to create a game design to apply the concepts learned so far, but i don't know what should be created with what. where should classes be used, or properties. What concepts should be private and which ones should be public. Any suggestions?
<image removed>
This workshop will teach C#, but it will not teach Object oriented design. I would suggest you go and find a good book that focuses just on that.
theTroll
Quote: Original post by alvarofrank
I have been trying to create a game design to apply the concepts learned so far, but i don't know what should be created with what. where should classes be used, or properties. What concepts should be private and which ones should be public. Any suggestions?
here
Wait until the workshop starts going into the final project, which will be a text based game. You'll see a lot of what you're wondering about when you see it take shape.
Quote: Original post by alvarofrank
I have been trying to create a game design to apply the concepts learned so far, but i don't know what should be created with what. where should classes be used, or properties. What concepts should be private and which ones should be public. Any suggestions?
here
In your case, you're items can be broken up as follows:
Classes (the objects in your chart)
Army
UnitPosition
Archers
Spear Infantry
etc...
Properties (the variables in your chart)
Health pts
Attack pts
Charge pts
Defense pts
Methods (the actions in your chart)
Attack
Charge
Move
Die
Enumerations (multiple choice options)
Army Formation
Terrain
Weather
Quote: Original post by Mike.Popoloski
In your case, you're items can be broken up as follows:
Classes (the objects in your chart)
Army
UnitPosition
Archers
Spear Infantry
etc...
Properties (the variables in your chart)
Health pts
Attack pts
Charge pts
Defense pts
Methods (the actions in your chart)
Attack
Charge
Move
Die
Enumerations (multiple choice options)
Army Formation
Terrain
Weather
THANKS that makes all the concepts a lot more clear. Thank You for your help. Its always easier with examples.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement