BAPFS Lecture 17

This commit is contained in:
ed committed 2022-07-14 01:25:31 -04:00
1 parent 83b0ee2974
commit 8ad16eb886
3 files changed
+1398 -1

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
class Point
{
def constructor(x, y)
{
this.x = x;
this.y = y;
}
def sum()
{
return this.x + this.y;
}
}
class Point3D extends Point
{
def constructor(x, y, z)
{
super(x, y);
this.z = z;
}
def sum()
{
return super() + this.z;
}
}
let
point = new Point(10, 20, 30);
point.sum();