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 #32 (Nicu G. Fruja)

using System;

class A
{
  public virtual void M(int i)
  {
    Console.WriteLine("A::M(int) called");
  }
}

class B: A
{
  public override void M(int i)
  {
    Console.WriteLine("B::M(int) called");
  }
  public void M(long i)
  {
    Console.WriteLine("B::M(long) called");
  }
}

class Test
{
  static void Main()
  {
    B b = new B();
    int i = 0;
    b.M(i);
  }
}

Cosa viene visualizzato a console? Qui non abbiamo C ma non vuol per niente dire che sia più semplice! :-)

  • A. B::M(long) called
  • B. B::M(int) called

Print | posted on lunedì 9 agosto 2004 18:39 | Filed Under [ Quiz Sharp ]

Powered by:
Powered By Subtext Powered By ASP.NET