Re: Consuming your own events.
Daniel Petersson <[email protected]> Wed, 30 Jan 2008 12:53:15 +0100
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <E8FBCCA96548DD46A1AC748F17EEAD9C0E96F6F4F1@cefalo-mail01.cefalo.local> |
of-course it doesn't you forgot to inherit A in B. --Daniel ________________________________________ From: Discussion of development on the .NET platform using any managed language [[email protected]] On Behalf Of Sébastien Lorion [[email protected]] Sent: Wednesday, January 30, 2008 12:52 PM To: [email protected] Subject: Re: [DOTNET-CLR] Consuming your own events. On 1/30/08, James Geall <[email protected]> wrote: > <quote>I personally have to disagree with your main point which is > "overridable is > bad because people can omit to call the base method". Well then, the same > applies to constructors. > </quote> > I am not sure this is 100% right. I think (certainly in c#) that the > compiler will call the default constructor on the base class if there is > one, and fail to compile if there is not. > I do not know if this holds true for other languages or if it's a CLR > feature. The following console app prints "in B ctor". A ctor is not called when creating B. using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { B b = new B(); Console.ReadLine(); } } class A { public A() { Console.WriteLine("in A ctor"); } } class B { public B() { Console.WriteLine("in B ctor"); } } } =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com