Files
carbon-lang/docs
josh11bandChandler Carruth 0820dec01f Nominal classes and methods (#722)
Add support for nominal (or "named") classes with encapsulation. Inheritance will be in a later proposal. Here is an example of the proposed syntax:

```
class Circle {
  fn Create(c: Point, r: f32) -> Self {
    return {.center = c, .radius = r};
  }
  fn Diameter[me: Self]() -> f32 {
    return me.radius * 2;
  }
  fn Expand[addr me: Self*](distance: f32);

  private var center: Point;
  private var radius: f32;
}

fn Circle.Expand[addr me: Self*](distance: f32) {
  me->radius += distance;
}
```

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2021-08-23 15:45:41 -07:00
..
2021-08-23 15:45:41 -07:00
2020-10-14 10:52:24 -07:00

Docs

This directory contains current, accepted documentation underpinning Carbon. These documents cover all aspects of Carbon ranging from the project down to detailed designs for specific language features.

If you're trying to learn more about Carbon, we recommend starting at /README.md.