32 lines
659 B
Plaintext
32 lines
659 B
Plaintext
# ============================================================
|
|
# Cross-module isinstance test library: classes defined here are imported by
|
|
# main.vp to verify vtable comparison resolves across object files.
|
|
# ============================================================
|
|
class Shape:
|
|
def area(self) -> int:
|
|
return 0
|
|
|
|
|
|
virtual class Circle(Shape):
|
|
r: int
|
|
|
|
def __init__(self, r: int):
|
|
self.r = r
|
|
|
|
def area(self) -> int:
|
|
return self.r
|
|
|
|
|
|
virtual class Square(Shape):
|
|
s: int
|
|
|
|
def __init__(self, s: int):
|
|
self.s = s
|
|
|
|
def area(self) -> int:
|
|
return self.s
|
|
|
|
|
|
novirtual class PlainShape:
|
|
tag: int
|