/ concept-collection / jupyterlite-numbl-kernel
Sign in
concept-collection / jupyterlite-numbl-kernel
jupyterlite-numbl-kernel / demo / content / +geom / Point.m
15 lines · 342 BBlameHistoryRaw
1classdef Point
2 % A class that lives inside the +geom package: geom.Point(...).
3 properties
4 x = 0
5 y = 0
6 end
7 methods
8 function obj = Point(x, y)
9 if nargin > 0, obj.x = x; obj.y = y; end
10 end
11 function d = dist(obj)
12 d = sqrt(obj.x^2 + obj.y^2);
13 end
14 end
15end
moveopenescclose