[Solved] What’s wrong about the first 2 public times?


Since Time is a struct all the fields need to be initialized in the constructor. Change your first two constructors to the following:

public Time(int s1)
{
    s = s1;
    m = h = 0;
}

public Time(int s1, int m1)
{
    s = s1;
    m = m1;
    h = 0;
}

or even better define them as this:

public Time(int s1) : this(s1, 0, 0) {}
public Time(int s1, int m1) : this (s1, m1, 0) {}
public Time(int s1, int m1, int h1)
{
    s = s1;
    m = m1;
    h = h1;
}

this way you have the alignments only in one place.

1

solved What’s wrong about the first 2 public times?