Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- struct Rectangle {
- width: u32,
- height: u32,
- profundidad: u32,
- }
- impl Rectangle {
- fn area(&self) -> u32 {
- a(&self) -> u32 {
- self.width * self.height * self.profundidad
- }
- }
- fn main() {
- let rect1 = Rectangle { width: 30, height: 50, profundidad: 20 };
- println!(
- "The area of the rectangle is {} square pixels.",
- rect1.area()
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement