From 898b1c827293c8ae87642be75703c3a0eb99bf22 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Tue, 2 Jul 2024 21:50:25 +0200 Subject: container: testing containers struct / file --- example-container/main.zig | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 example-container/main.zig (limited to 'example-container/main.zig') diff --git a/example-container/main.zig b/example-container/main.zig new file mode 100644 index 0000000..9020adb --- /dev/null +++ b/example-container/main.zig @@ -0,0 +1,21 @@ +const Object = @import("Object.zig"); + +const Moose = struct { + foo: i32, + + fn dump(self: Moose) void { + const print = @import("std").debug.print; + print("Self = {s}\n", .{@typeName(Moose)}); + print("FOO = {}\n", .{self.foo}); + } +}; + +pub fn main() void { + const o12 = Object.init(12); + const o13 = Object.init(13); + o12.dump(); + o13.dump(); + + const m = Moose{ .foo = 42 }; + m.dump(); +} -- cgit v1.2.3