Re: Declaring a Constructor in an Interface?
From: Dennis Myrén (dennis_at_oslokb.no)
Date: 09/15/04
- Next message: Baris: "Library License"
- Previous message: Lubo¹ ©lapák: "iframe"
- In reply to: Dennis Myrén: "Re: Declaring a Constructor in an Interface?"
- Next in thread: Jon Skeet [C# MVP]: "Re: Declaring a Constructor in an Interface?"
- Reply: Jon Skeet [C# MVP]: "Re: Declaring a Constructor in an Interface?"
- Reply: Ian Griffiths [C# MVP]: "Re: Declaring a Constructor in an Interface?"
- Reply: Ignacio Machin \( .NET/ C# MVP \): "Re: Declaring a Constructor in an Interface?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Sep 2004 12:49:58 +0200
Well, in that case I have to apologize if i was wrong.
However, i have read many places that an interface is faster than
an abstract class. This is one of them:
http://www.dotnetspider.com/Technology/KB/ShowSample.aspx?SampleId=492
I wont argue with You, but would You also claim that an abstract class
containing only abstract members
is faster than an interface as well? In that case, what is the benefit of
interfaces anyway?
I have always believed interfaces were superior to abstract classes.
I apologie for the misleading information i might have given.
-- Regards, Dennis JD Myrén Oslo Kodebureau "Dennis Myrén" <dennis@oslokb.no> wrote in message news:bPT1d.7270$WW4.107246@news4.e.nsc.no... > You need to create 2 class instances > when creating an instance of a class which is derived from an abstract > class. > > Creating an instance of an abstract class means performance overhead. > I think that is especially true if the abstract class contains virtual > methods. > > Virtual methods always means performance overhead. > According to Microsoft they are two times as expensive as non-virtual > methods. > > However, abstract members should be as fast as interface members i believe. > > An abstract class containing no virtual methods should be nearly as fast > as an interface, but still slower. > > > > -- > Regards, > Dennis JD Myrén > Oslo Kodebureau > "Richard Blewett [DevelopMentor]" <richardb@develop.com> wrote in message > news:%23E$QQEwmEHA.3852@TK2MSFTNGP10.phx.gbl... > > What leads you to the conclusion that interfaces are faster than ABCs? > > > > Regards > > > > Richard Blewett - DevelopMentor > > > > http://staff.develop.com/richardb/weblog > > > > > nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<2VS1d.7254$WW4.107148@news4.e.nsc.no> > > > > Unfortunately this is not possible. > > > > You may use an abstract class instead which exposes 1 constructor > > taking a UserToken though. > > > > I really wished that this was possible, because interfaces are faster > than > > abstract classes. > > > > -- > > Regards, > > Dennis JD Myr?n > > Oslo Kodebureau > > "Ole Hanson" <ole.hanson@ole.ole> wrote in message > > news:egAtlqvmEHA.3632@TK2MSFTNGP09.phx.gbl... > > > I am accessing my database through an interface, to allow future > > > substitution of the physical datastore - hence I would like to declare > in > > my > > > Interface that my DAL-objects implementing the interface and accessing > the > > > datastore MUST pass in a UserToken in the constructor of the object. > > > > > > Is this not possible? > > > Am I forced to add the UserToken as a property on the object instead? > > > > > > /Ole > > > > > > > > > > > > > > > > > --- > > Incoming mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.760 / Virus Database: 509 - Release Date: 10/09/2004 > > > > > > > > [microsoft.public.dotnet.languages.csharp] > >
- Next message: Baris: "Library License"
- Previous message: Lubo¹ ©lapák: "iframe"
- In reply to: Dennis Myrén: "Re: Declaring a Constructor in an Interface?"
- Next in thread: Jon Skeet [C# MVP]: "Re: Declaring a Constructor in an Interface?"
- Reply: Jon Skeet [C# MVP]: "Re: Declaring a Constructor in an Interface?"
- Reply: Ian Griffiths [C# MVP]: "Re: Declaring a Constructor in an Interface?"
- Reply: Ignacio Machin \( .NET/ C# MVP \): "Re: Declaring a Constructor in an Interface?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|