diff --git a/src/content/language/constructors.md b/src/content/language/constructors.md index f1a1201d23..bb7c3f1226 100644 --- a/src/content/language/constructors.md +++ b/src/content/language/constructors.md @@ -51,12 +51,12 @@ To instantiate a class, use a generative constructor. ```dart class Point { - // Initializer list of variables and values - double x = 2.0; - double y = 2.0; + // Instance variables to hold the coordinates of the point. + double x; + double y; - // Generative constructor with initializing formal parameters: - Point(this.x, this.y); + // Generative constructor with optional positional parameters and default values. + Point([this.x = 2.0, this.y = 2.0]); } ```