2020-03-28 14:45:55 +01:00
|
|
|
mod car;
|
|
|
|
use car::Information;
|
|
|
|
|
|
|
|
fn main() {
|
2020-03-28 19:49:57 +01:00
|
|
|
// create a new car and store it in the variable 'a'
|
2020-03-28 14:45:55 +01:00
|
|
|
let a = car::Car {
|
2020-03-28 19:49:57 +01:00
|
|
|
// set some data for that car
|
2020-03-28 14:45:55 +01:00
|
|
|
manufacturer: "Benz".to_string(),
|
|
|
|
model: "Velo".to_string()
|
|
|
|
};
|
|
|
|
|
2020-03-28 19:49:57 +01:00
|
|
|
// do the same for a second car
|
2020-03-28 14:45:55 +01:00
|
|
|
let b = car::Car {
|
|
|
|
manufacturer: "Ford".to_string(),
|
|
|
|
model: "Model T".to_string()
|
|
|
|
};
|
|
|
|
|
2020-03-28 19:49:57 +01:00
|
|
|
// use a function of the car class to print out the information
|
2020-03-28 14:45:55 +01:00
|
|
|
a.print_info();
|
|
|
|
b.print_info();
|
|
|
|
}
|