Okay, I'll try to explain the code in your for loop as clearly as I can.
Your first two lines of output was written when the code enter the for loop in this part:
for (a = 0; a < 10; a++)
10
converted to Nybble cause you only override operator < for Nybble to Nybble, not Nybble to int.
causing the code to write these lines to the compiler
int to obj<br />
int to obj
The next lines were written in your loop
Console.Write((int)a + " ");
I assume you already know that above code will print this output:
obj to int<br />
0
--There's a space after 0
So, why did the code print
obj to int<br />
0 int to obj
instead of above desired output?
This is because you're implementing a one-line loop
Therefore, after the code print
0
the code will go back to check the loop here:
for (a = 0; a < 10; a++)
When the check to
a < 10
is performed, the code will print
int to obj
next to your previous output
resulting in your output above
Now try to change the loop into this one:
for (a = 0; a < 10; a++){
Console.Write((int)a + " ");
Console.WriteLine();
}
The output should be like this :
int to obj<br />
int to obj<br />
obj to int<br />
0<br />
int to obj<br />
obj to int<br />
1<br />
int to obj<br />
obj to int<br />
....