summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-06-16 20:37:27 -0700
committerGitHub <noreply@github.com>2025-06-16 20:37:27 -0700
commita4345725a083651c16795d27fedd769f2d7e55ae (patch)
tree763c27f687e25e081a87cd266ca1442f5f6624ad /docs
parent07f79b943c3041dd18137d72893af260b75ddcf9 (diff)
Require `override` keyword for overriding default interface methods. (#7458)
* Require `override` keyword for overriding default interface methods. * Update doc. * Fix test.
Diffstat (limited to 'docs')
-rw-r--r--docs/user-guide/06-interfaces-generics.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/user-guide/06-interfaces-generics.md b/docs/user-guide/06-interfaces-generics.md
index 1912fcb02..bb19fd776 100644
--- a/docs/user-guide/06-interfaces-generics.md
+++ b/docs/user-guide/06-interfaces-generics.md
@@ -58,6 +58,17 @@ interface IFoo
struct MyType : IFoo {}
```
+A concrete type that provides its overriding implementation to an interface method requirement that has a default implementation must be explicitly marked as 'override'. For example:
+
+```slang
+struct MyType2 : IFoo
+{
+ // Explicitly mark `getVal` as `override` is needed
+ // because `IFoo.getVal` has a body.
+ override int getVal() { return 1; }
+}
+```
+
Generics
---------------------