ModularM
Modular3y ago
11 replies
khaVulture

TraitsRequiring Static Methods

What am I doing wrong below? please help.

trait HasStaticMethod:
@staticmethod
fn work(): ...

@value
struct WashingMachine:
@staticmethod
fn work():
print("Wash the clothes!")


@value
struct Cooker:
@staticmethod
fn work():
print("Cook the food!")

fn main():
fn do_workT: HasStaticMethod:
T.work()

do_work(WashingMachine())
Was this page helpful?