public class ElapsedTime
{
public int hours;
public int minutes;
public void ElapsedTime(int h, int m)
{
hours = h;
minutes = m;
}
}
from another event i am doing this:
ElapsedTime BeginningTime = new ElapsedTime();
how would i initialize the h
and m
?
when i try to do this: BeginningTime.ElapsedTime(7, 7);
it gives me this error:
Error 1 'ElapsedTime': member names cannot be the same as their enclosing type
all i want is a class with a constructor that accepts initializing values. and i want to be able to call it.
UPDATE:
now i have :
public class ElapsedTime
{
private int hours;
private int minutes;
public ElapsedTime(int h, int m)
{
hours = h;
minutes = m;
}
}
its giving me that same erorr on public ElapsedTime(int h, int m)