Now I am going to start as it looks like Mendhak have done lately....here is the next question.
I am trying to make a new object of a class. The class uses delegations. The class looks like this:
But when I simply try to make an object of it, like this:Code:using System;
namespace Spaceobj {
public delegate void trackOfDay(int p_iDay);
public class cClock {
public cClock(int p_iDay)
{
iDay = p_iDay;
}
public int iDay;
// Event to tell the planets to move.
public event trackOfDay moveAcordingly;
// Angi ny dag
public void NyDag(int p_iDay) {
iDay = (iDay + 1) % 365;
moveAcordingly(iDay);
}
};
}
then it compiles fine, but when I run it, then it crashes saying.Code:cClock earthDay = new cClock(1);
Quote:
An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an object.
