I don’t know what this error means

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WindowsFormsApplication1

{

public partial class Form1 : Form {

 Profesor Resinovič = new Profesor("Boštjan", "Resinovič", 35, 1500); Razred r1a = new Razred("R-1.a", Resinovič); public Form1() { InitializeComponent(); } } 

}

and i get this error : A field initializer cannot reference the nonstatic field, method, or property …. i would like to make the object Razred r1a a global variable to use in the events but i get this error

by 11zagy via /r/csharp

Leave a Reply