I have a simple class that creates unique ID numbers:
public static class ID
{
private static int iD = 0;
public static int GetNextID()
{
return iD++;
}
}
If I want each instance of an abstract class to automatically get a new non changeable ID when instantiated, how do I go about that?
The following won't work:
public abstract class MyClass
{
protected const int ID = ID.GetNextID();
}