• Home
  • Getting Started
  • Tutorial
  • Editors & IDEs
  • Documentation
  • News
Close Menu
  • Developers
  • JS++
  • Language
  • Reference
  • Types
  • User-defined Types
  • Expressions
    • Statements
      • Modifiers
        • Types
          • Array Types
          • Existent Types
          • Function (Callback) Types
          • Nullable Types
          • Primitive Types
            • User-defined Types

          User-defined Types

          JS++ supports user-defined types via the class keyword, interface keyword, and enum keyword. All user-defined types are - by default - internal types.

          Example

          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          class Point
          {
              int x;
              int y;
           
              Point(int x, int y) {
                  this.x = x;
                  this.y = y;
              }
          }

          The Point class above can now be used as follows:

          1
          Point origin = new Point(0, 0);

          See Also

          • class Keyword
          • interface Keyword
          • enum Keyword

          Share

          HTML | BBCode | Direct Link