online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online Rust Compiler. Code, Compile, Run and Debug Rust program online. Write your code in this editor and press "Run" button to execute it. *******************************************************************************/ trait HasWeight { fn weight(&self) -> u32; } struct Cat {} impl HasWeight for Cat { fn weight(&self) -> u32 { 42 } } struct Dog {} impl HasWeight for Dog { fn weight(&self) -> u32 { 9001 } } struct CatDog { cat: Cat, dog: Dog, } impl HasWeight for CatDog { fn weight(&self) -> u32 { self.cat.weight() + self.dog.weight() } } fn main() { let dog = Dog{}; let cat = Cat{}; let catdog = CatDog{ cat: Cat{}, dog: Dog{} }; println!("{}", cat.weight()); println!("{}", dog.weight()); println!("{}", catdog.weight()); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue