Skip to content

Instantly share code, notes, and snippets.

@will-lp
Last active August 29, 2015 13:57
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 will-lp/9386502 to your computer and use it in GitHub Desktop.
Save will-lp/9386502 to your computer and use it in GitHub Desktop.
Metaclass inheritance
class A {
def foo() { 'foo' }
}
class B extends A {
def bar() { 'bar' }
}
A.metaClass.foobar { 'foobar' }
assert new B().foobar() == 'foobar'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment