Positional Data Members in Records
Learn about positional data members and simplify record syntax.
We'll cover the following
The syntax for defining a record can be greatly simplified using positional data members.
Simplifying data members in records
Instead of using object initialization syntax with curly braces, sometimes we might prefer to provide a constructor with positional parameters. We can also combine this with a deconstructor for splitting the object into individual parts, as shown in the following code:
Get hands-on with 1400+ tech skills courses.