What Part of Speech is of?

The part of speech that the word ‘of’ is, would be a preposition. A teacher once told me a preposition is anything that can be done to a box with an object. You can put an object on a box, in a box, under a box, beside a box, and off a box…so those are all prepositions.