Add associated function example
This commit is contained in:
		
							parent
							
								
									3e2ec6ed6b
								
							
						
					
					
						commit
						b03adf0ab6
					
				
							
								
								
									
										14
									
								
								examples/associated_functions.reid
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								examples/associated_functions.reid
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | ||||
| struct Otus { | ||||
|     field: u32, | ||||
| } | ||||
| 
 | ||||
| impl Otus { | ||||
|     fn test(&self) -> u32 { | ||||
|         *self.field | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| fn main() -> u32 { | ||||
|     let otus = Otus {}; | ||||
|     return Otus::test(&otus); | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user