Updated docs to new version

This commit is contained in:
2026-07-12 07:55:13 -04:00
parent 59fec35aea
commit b419a1c7c7
7 changed files with 79 additions and 23 deletions
+25
View File
@@ -33,6 +33,29 @@ class Player
}
```
### Virtual Methods
The `virtual` keyword marks methods as dispatchable through the vtable, enabling polymorphic behavior:
```mist
pub class Animal
{
str& name;
pub constructor(str& name)
{
self.name = name;
}
pub virtual void speak(&self)
{
println!("...");
}
}
```
When a method is marked `virtual`, it can be overridden in subclasses and will be dispatched dynamically at runtime through the vtable. Non-virtual methods are called statically.
### Inheritance
```mist
@@ -59,6 +82,8 @@ void speak(&self) override(Animal)
}
```
Methods marked `override` are automatically virtual if the parent method is virtual. The semantic analyzer validates that overridden methods match the parent's signature.
### Implementations
You can implement directly on the class body: