// as example a for a person
struct Person {
pub name : String, // public
age : u8, // private
// here are all the attributes and there types
}
// impl contains all functions and methods that will be implemented to your struct
impl Person {
// a function from the class itself
fn new(name:String, age:u8) -> Self {
// crate an instace of the class
Person {
name : name,
age : age
}
}
// a method from an object of this class
fn get_age(self) -> u8 {
// `self` is the object itself and the same like `this` in java
self.age
}
}