Al's BrainDump

RSS

Navigation





Quick Search
»
Advanced Search »

PoweredBy

Classes

Can only inherit from 1 class and virtual and override keywords control method overiding.

ClassA
public virtual void method1()

ClassB:Class A
public override void method1()

ClassC:ClassB
public override void method1()   // this is where sealed would have been handy in classB if they didnt want it to derived by C

Interfaces

An Interface is a reference type and it contains only abstract members. Interface's members can be Events, Methods, Properties and Indexers. But the interface contains only declaration for its members. Any implementation must be placed in class that realizes them. The interface can't contain constants, data fields, constructors, destructors and static members. All the member declarations inside interface are implicitly public.

    class ClonableNode : INode,ICloneable //Inherit 2 interfaces (could also put 1 class in here)
    { 
        // INode members here
        //blah...All node implementations

        //lets say clone interface only has 1 member - implement here
        public object Clone() 
        {
        return null; 
        } 
    }

ScrewTurn Wiki version 3.0.5.600. Some of the icons created by FamFamFam.