Each class you define in the Ontology module results in C# class files in the folder "App_Code". The class is marked as "partial" and the class is defined by two files, one under "App_Code/WAF" and one under "App_Code/WAF_Custom". The file under "App_Code" is maintained by the system and overritten on each rebuild. The file under "WAF_Custom" is only created once and never overritten. In this file you can override various methods and propeties to change the behaviour of the class. Typically you can override the method "OnAfterUpdate" if you want to trigger other actions each time the content is changed.
This possibility to ovveride methods and interact with content events applies to both classes that inherit from the base class "ContentBase" and "InnerContentBase". Please note that the functionality is not enabled by default on inner contents (for performance reasons). To override events on Inner Contents, you must first override a property called "virtual bool InvokeInnerContentsEventMethods" and let it return true on the root content class the inner content is related to.