Open main menu

CDOT Wiki β

Changes

GPU621/The Chapel Programming Language

55 bytes removed, 14:34, 20 November 2020
Classes:
==== Classes: ====
A class is a type of collection that can contain collects ''variables'' and ''constants'', ''called fields'', as well as ''functionsprocedures'' and ''iterators'' called methods. A new class type is declared using the We use '''class''' keywordto declare a new class type.
class C myClass {
var a, b: int;
proc printFieldsprint() {
writeln("a = ", a, " b = ", b);
}
The '''new''' keyword creates an instance of a class by calling an initializer.
var foo = new CmyClass(0, 1, 3); foo.printFieldsprint();
==== Records: ====
25
edits