Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Last active December 24, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolfbjarne/8c9d4598d8e9ec2c511e to your computer and use it in GitHub Desktop.
Save rolfbjarne/8c9d4598d8e9ec2c511e to your computer and use it in GitHub Desktop.
using System;
using System.Threading;
class Base {
public Base ()
{
Console.WriteLine ("Base.ctor");
ViewDidLoad ();
}
public virtual void ViewDidLoad ()
{
Console.WriteLine ("Base.ViewDidLoad");
}
}
class Derived : Base {
public Derived ()
{
Console.WriteLine ("Derived.ctor");
}
public override void ViewDidLoad ()
{
Console.WriteLine ("Derived.ViewDidLoad");
base.ViewDidLoad ();
}
static void Main ()
{
new Derived ();
}
}
/*
* This prints:
Base.ctor
Derived.ViewDidLoad
Base.ViewDidLoad
Derived.ctor
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment