[C#] Problem z przekazywaniem przez referencje

0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        public void Funkcja(ref int x)
        {
            x++;
        }
        static void Main(string[] args)
        {
            int b;
            b=9;
            Funkcja(ref b);
            Console.WriteLine(b);
            Console.ReadKey();
        }
    }
}

Podczas wywołania Funkcja(ref b); pokazuje się błąd:
An object reference is required for the non-static field, method, or property 'ConsoleApplication1.Program.Funkcja(ref int)'
O co chodzi??

0

dobra już wiem o co chodzi :D

0

Metoda main jest statyczna, a metoda Funkcja nie - i wywołanie z main nie jak użyć Funkcja, nie ma obiektu.

1 użytkowników online, w tym zalogowanych: 0, gości: 1