/******************************************************************************
Online Rust Compiler.
Code, Compile, Run and Debug Rust program online.
Write your code in this editor and press "Run" button to execute it.
*******************************************************************************/
struct A {}
struct C {}
struct B {}
impl A {
fn foo(self) -> u8 {
1
}
}
impl B {
fn foo(self) -> u8 {
2
}
}
impl C {
fn foo(self) -> u8 {
3
}
}
struct ABC {
a: A,
b: B,
c: C,
}
impl ABC {
fn new() -> Self {
Self {
a: A{},
b: B{},
c: C{},
}
}
fn foo(self) -> u8 {
let sum = self.a.foo() + self.b.foo() + self.c.foo();
sum
}
}
fn main() {
let abc = ABC::new().foo();
println!("{}", abc);
}