View MethodOverridingDemoUnity.cs
using UnityEngine; | |
namespace PolymorphismDemo | |
{ | |
public class A | |
{ | |
public virtual void Foo() { Debug.Log ("A.Foo()"); } | |
} | |
public class B : A |
View MethodOverridingDemo.cs
using System; | |
namespace PolymorphismDemo | |
{ | |
public class A | |
{ | |
public virtual void Foo() => Console.WriteLine("A.Foo()"); | |
} | |
public class B : A |
View staticBinding.go
package main | |
import "fmt" | |
type Thing interface { | |
coolify() | |
coolifyAndShout() | |
} | |
type CoolThing struct { |