abstract class vs interface in term of speed

Hi guys,

I read every whare abstract class are faster then interface because interface require extra in direction. i want to know about how compiler deals with interface and abstract class.

Thanks



Answer this question

abstract class vs interface in term of speed

  • joynerCN

    iExample.Test() and cExample.Test() both "Test" method having same code.

    Thanks

    Mahesh

    http://geekswithblogs.net/mahesh


  • Shajeel

    What were the results



  • Skipping Rock

    Hi,

    Thanks for your reply.

    i mean to say if i am implementing a interface method VS overridiing a method.

    speed during calling the method through base type variable

    interface IExample

    {

       void Test();

    }

    class Example : Interface

    {

       void Test()

      {

           //some code

      }

    }

     

    Class CExample

    {

       public vitual void Test()

       {

           //some code 

       }

    }

     

    Class Example1 : CExample

    {

        public overide void Test()

         {

              //some code

         }

    }

     

    Class TestSpeed

    {

       IExample iExample = new Example();

       iExample.Test();

       CExample cExample = new Example1();

        cExample.Test();

    }

     

     

    i mean to say which one is faster iExample.Test() or cExample.Test();

     

    Thanks

    http://geekswithblogs.net/mahesh/


  • snowrabbit

    hi,
    gays i think doesn't matter for code speed, we don't live in stone era. The question is what is better solution interface or abstract class.there is my vision

    Thanks in advice


  • Nikita Mironov

    What kind of test would you write that would answer your question



  • jamil

    I recomend to read this article http://msdn.microsoft.com/library/default.asp url=/library/en-us/dndotnet/html/fastmanagedcode.asp

    BTW, interface methods are internally just abstract methods, there is no reasonable difference you should care about



  • abstract class vs interface in term of speed