You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::f64::consts::PI;traitShape{fnnew(area:f64) -> Self;}structCircle{radius:f64}structSquare{length:f64}implShapeforCircle{fnnew(area:f64) -> Circle{Circle{radius:(area / PI).sqrt()}}}implShapeforSquare{fnnew(area:f64) -> Square{Square{length: area.sqrt()}}}let area = 42.5;let c:Circle = Shape::new(area);let s:Square = Shape::new(area);
Why is this wrong
let c = Circle::new( area );let s = Square::new( area );
traits-test.rs:126:10: 126:21 error: unresolved name
traits-test.rs:126 let c = Circle::new( area );
^~~~~~~~~~~
traits-test.rs:126:10: 126:21 error: use of undeclared module `Circle`
traits-test.rs:126 let c = Circle::new( area );
^~~~~~~~~~~
traits-test.rs:126:10: 126:21 error: unresolved name `Circle::new`.
traits-test.rs:126 let c = Circle::new( area );
^~~~~~~~~~~
traits-test.rs:127:10: 127:21 error: unresolved name
traits-test.rs:127 let s = Square::new( area );
^~~~~~~~~~~
traits-test.rs:127:10: 127:21 error: use of undeclared module `Square`
traits-test.rs:127 let s = Square::new( area );
^~~~~~~~~~~
traits-test.rs:127:10: 127:21 error: unresolved name `Square::new`.
traits-test.rs:127 let s = Square::new( area );
^~~~~~~~~~~
error: aborting due to 6 previous errors
The text was updated successfully, but these errors were encountered:
Why is this wrong
The text was updated successfully, but these errors were encountered: