Re: Consuming your own events.

Davy Brion <[email protected]> Wed, 30 Jan 2008 12:56:09 +0100
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
why would it? B doesn't inherit A :p

On 1/30/08, Sébastien Lorion <[email protected]> wrote:
> 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(R)  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