Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formal class definition #76

Open
thosakwe opened this issue Apr 25, 2018 · 0 comments
Open

Formal class definition #76

thosakwe opened this issue Apr 25, 2018 · 0 comments

Comments

@thosakwe
Copy link
Contributor

Full:

class Foo: Bar, Baz, Quux mixes MyMixin {
  // Some docs here
  hide _bar: String
  age: Int

  new(this.age):super() {
    
  }

  static from(foo: Foo) => Foo(foo.age)

  fn get bar => _bar

  fn set bar(value: String) {
    throw 'wtf?'
  }
}

The difference between a class and a struct type:

  • Classes can have implementation of methods, whereas a struct type is merely an interface
  • this and super are available
  • Can have constructors
  • Static members
  • Initializers in constructors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant