Compound data type
Compound data type
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
Ada
The parent package defines the Point type.
package Shapes is type Point is tagged private; private type Point is tagged record X : Integer := 0; Y : Integer := 0; end record; end Shapes;
BASIC
Interpeter: QuickBasic 4.5, PB 7.1
TYPE Point x AS INTEGER y AS INTEGER END TYPE
C
Compiler: GCC, MSVC, BCC, Watcom
Libraries: Standard
typedef struct Point { int x; int y; } Point;
C++
Compiler: GCC, Visual C++, BCC, Watcom
struct Point { int x; int y; };
C#
struct Point { public int x, y; public Point(int x, int y) { this.x = x; this.y = y; } }
D TODO
Forth TODO
Fortran TODO
Java
class Point { public int x, y; public Point() { this(0); } public Point(int x0) { this(x0,0); } public Point(int x0, int y0) { x = x0; y = y0; } }
JavaScript TODO
Perl TODO
Interpeter: Perl