One of most specific things in C# is instances. Most beginners don't understand what is instance. I'm here to make you understand.
Let's have one class ( I hope you know what class is! ). We will name it VoidFunkcija ( this is on Croatian. You can name it whatever you want but you will need to remember it for latter ). OK. After we named our class we will create a function/method inside our class.
this is the code for our function/method:
public void Bezveze()
{
Console.WriteLine("Bok");
}
Bezveze means "no meaning" or "stupid" and Bok means "Hello".
After we create our function/method we will create Main function ( remember!!! Every C# program needs to have Main function just like in C or C++ ).
Inside Main function we will create Instance of our VoidFunkcija class. Why is that important? Well you will see in our code.
This is code for instance:
VoidFunkcija a = new VoidFunkcija();
Now we can use our function/method inside our Main function. How??? Like this:
for (i = 0; i < n; i++)
{
a.Bezveze();
}
If you have some question just ask


Sign In
Create Account


Back to top









