Skip to content

Commit

Permalink
Update idiomatic constructor example for Point
Browse files Browse the repository at this point in the history
  • Loading branch information
danielerat committed Nov 15, 2024
1 parent d71de7e commit 43343f3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/misc/lib/language_tour/classes/point_alt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
///
// #docregion idiomatic-constructor
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]);
// #enddocregion idiomatic-constructor

// #docregion initializer-list
Expand Down

0 comments on commit 43343f3

Please sign in to comment.