Web Log di Adrian Florea

"You know you've achieved perfection in design, not when you have nothing more to add, but when you have nothing more to take away." Antoine de Saint-Exupery
posts - 440, comments - 2715, trackbacks - 3944

My Links

Archives

Post Categories

Image Galleries

.RO Blogs

.RO People

.RO Sites

Blogs

Furls

Links

vinCitori

Quiz Sharp 12

using System;

class Base
{
  public Base()
  {
    Method();
  }
  public virtual void Method()
  {
    Console.WriteLine("I'm the Base");
  }
}

class Derived: Base
{
  public Derived()
  {
    Method();
  }
  public override void Method()
  {
    Console.WriteLine("I'm the Derived");
  }
}

class Foo
{
  static void Main()
  {
    Derived d = new Derived();
    d.Method();
    Console.Read();
  }
}

Cosa viene visualizzato a console?

  • A.
    I'm the Derived
    I'm the Derived
  • B.
    I'm the Derived
    I'm the Derived
    I'm the Derived
  • C.
    I'm the Base
    I'm the Derived
    I'm the Derived

Il quiz è ispirato da questo post di Stephen Dunn (da leggere anche tutti i "Next in topic"), post a sua volta ispirato da questa regola FxCop.

Print | posted on domenica 30 maggio 2004 03:25 | Filed Under [ Quiz Sharp ]

Powered by:
Powered By Subtext Powered By ASP.NET