Logo

Programming-Idioms

History of Idiom 5 > diff from v364 to v365

Edit summary for version 365 by programming-idioms.org:
[D] Comments

Version 364

2017-07-29, 23:22:02

Version 365

2017-07-29, 23:22:52

Idiom #5 Create a 2D Point data structure

Declare a container type for two floating-point numbers x and y

Illustration

Idiom #5 Create a 2D Point data structure

Declare a container type for two floating-point numbers x and y

Illustration
Code
class Point
{
	float x;
	float y;
}
Code
class Point
{
    float x;
    float y;
}
Comments bubble
D supports both struct (value types) and classes (reference types)
Comments bubble
Classes are reference types.