3
Reply

what is diffreence between abstract and virtual method in csharp ?

    Abstract method - Abstract class can have this. These methods have to be implemented in the derived class. Abstract method will not have implementation.


    Virtual method - Will have implementation and the base class can override using override keyword if needed.

    dear abstract is a complete class and virtual is a part of overriding in c#
    details
    abstract method:
              its an empty class it show the definitions of the method which u r using in class and it also has its own methods and variables
    virtual method:
    actually when we make same methods with same name and with same return type and with same parameters in differnt classs when we use virtual and override concept in class
    example:
    class A
    {
    void virtual abc(sting a)
    {

    }
    }
    Class B:A
    {
    void override abc(string a)
    {

    }
    }