Skip to content

Instantly share code, notes, and snippets.

@to11mtm
Last active October 1, 2025 21:34
Show Gist options
  • Select an option

  • Save to11mtm/b131c72c1d5c534fbd71b45468787173 to your computer and use it in GitHub Desktop.

Select an option

Save to11mtm/b131c72c1d5c534fbd71b45468787173 to your computer and use it in GitHub Desktop.
Abstract Class Funpost
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
namespace derp;
class Program
{
static void Main(string[] args)
{
var obj = new object();
var fake = Unsafe.As<Foo>(obj);
Console.WriteLine("Hello, World!");
fake.Baz();
var wat = new Wow(){The = "Wat"};
var fake2 = Unsafe.As<Wat>(wat);
fake2.Baz();
}
}
abstract class Foo
{
public abstract void Bar();
public void Baz()
{
Console.WriteLine("Baz");
}
}
abstract class Wat
{
public string The { get; set; }
public abstract void Bar();
public void Baz()
{
Console.WriteLine(The);
}
}
public class Wow
{
public string The { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment