update INHERITED style
Change-Id: Ic7f3dcd39083b933e1974546e4e43c981582aa58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314928
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/site/dev/contrib/style.md b/site/dev/contrib/style.md
index 4fc2a7d..187ac15 100644
--- a/site/dev/contrib/style.md
+++ b/site/dev/contrib/style.md
@@ -329,17 +329,6 @@
};
~~~~
-Subclasses should have a private typedef of their super class called INHERITED:
-
-<!--?prettify?-->
-~~~~
-class GrDillPickle : public GrPickle {
- ...
-private:
- typedef GrPickle INHERITED;
-};
-~~~~
-
Virtual functions that are overridden in derived classes should use override,
and the virtual keyword should be omitted.
@@ -349,16 +338,24 @@
}
~~~~
-All references to base-class implementations of a virtual function
-should be explicitly qualified:
+If you call a method on a parent type that must stand out as specifically the
+parent's version of that method, we usually privately alias that parent type to
+`INHERITED` within the class. That lets calls like `INHERITED::onFoo()` stand
+out visually. No need for `this->` when using `INHERITED::`.
<!--?prettify?-->
~~~~
-void myVirtual() override {
+class GrDillPickle : public GrPickle {
...
- this->INHERITED::myVirtual();
+ bool onTasty() const override {
+ return INHERITED::onTasty()
+ && fFreshDill;
+ }
...
-}
+private:
+ bool fFreshDill;
+ using INHERITED = GrPickle;
+};
~~~~
Constructor initializers should be one per line, indented, with punctuation