in class, at class, in the class or ….

As simple as this problem may seem, It has been driving me crazy for quite a while now!

Look at this sentence:
“I was in the class. I told the students to open up their books to page 45 and asked one of them to start reading from line 12″

Is there a difference between the sentence above and this one:
“I was at class/at the class, I told the ….”

or this one:
“I was in class. I told the …”

I just want to let you know that I’m almost totally familiar with definite and indefinite articles and the differences between in an at. but even natives use this prepositions in a strange way from time to time.