I had an interview for an internship ("I'm not sure this word is) and the interviewer asked me to tell him what the differences are between structure and class.
So, I told him everything that I knew, and everything that I read in msdn.
And the guy said "not enough," I had no idea. Therefore he said:
The structure is optimized, so if there are integer and float that have some bites, then they save this space, so struct with int=0 and float=0 is half the size of int=int.MAX , float=float.MIN .
Good. So I thought - did not hear about it.
But then, after the interview, I thought about it, and it makes no sense to me. This would mean that the size of the structure is different when we change the value of any variable in it. And it cannot really be in the same place in memory that, if there is a collision during expansion. And we would need to write some bits that we skip, I'm not sure that this will give any optimization.
He also asked me to ask what is the difference in structure and class in Java. To which I replied that in Java there is no structure, and he said: "Not for programmers, but for numeric types - structures." I was like WTF.
Basically the question arises:
Did this guy know something that is very difficult to find out (I mean, I searched him on the Internet, I can’t find anything)
or maybe he knows nothing about his work and is trying to look cool in an interview.