Records




Overview





Introduction to Records




Records - The Bottom Line


Example: A Type for a Pair of Integers


Example: Java Class Pair


Example: Ada Record Type Pair





Declaration, Allocation, Default Values, Initialization, Aggregate Assignment




Declaration and Allocation of Variables


Default Values


Initialization


Aggregate Assignment


New Operations





Types for Record Fields




Legal Types for Record Fields


Getting Around this Restriction





Operations and Reference and Value Semantics




Record Operations


Remember Reference and Value Semantics


Assignment and Equality Operations


Reference and Value Semantics


References, Aliases, and Debugging





Records as Parameters




Records as Parameters


Swapping Pairs in Java


Records with functions (and Redefining Operators!)





New Operations and Abstract Data Types




Record Operations


Defining New Operations


Defining Abstract Data Types (ADTs)





Perspective: Terms, Composite Types




Record: The Term


Record and Classes: Both Define Composite Types


Records and Classes: Similar but Significant Differences





Up Next




Up Next