forked from HQU-gxy/camera-extrinsic-play
17 lines
275 B
Python
17 lines
275 B
Python
from typing import Protocol, TypeVar, Generic
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
class Adder(Generic[T], Protocol):
|
|
def add(self, a: T, b: T) -> T: ...
|
|
|
|
|
|
class AdderImpl(Adder[int]):
|
|
acc: int
|
|
|
|
def add(self, a: int, b: int):
|
|
self.acc = a + b
|
|
return self.acc
|
|
|