Ejemplo n.º 1
0
    void UseControllingInheritance()
    {
        FinalizedObject finalizedObject = new FinalizedObject();

        /*                                              │                 */
        finalizedObject.ExtensionFunction();//←─────────┘
        /*                      ↑                                         */
        /*            ┌─────────┴──────────────────────┐                  */
        /*            │function not actually written in│                  */
        /*            │the FinalizedObject class.      │                  */
        /*            └────────────────────────────────┘                  */

        finalizedObject.AnotherExtension(7);
        // AnotherExtension: 7

        AnotherSealedClass another = new AnotherSealedClass();

        another.AnotherExtension(3);
        //SealedFunctions's sealedArg:3
    }
Ejemplo n.º 2
0
 public static void AnotherExtension(this FinalizedObject finalObj, int someArg)
 {
     Debug.Log("AnotherExtension: " + someArg);
 }
Ejemplo n.º 3
0
 public static void ExtensionFunction(this FinalizedObject finalObj)
 {
     Debug.Log("Extending the finalizedObject.");
 }