+ 3

Polymorphism and Abstraction

Need help anyone can explain Polymorphism and abstraction with example.

7th May 2017, 4:27 AM
Fatihullah Noory
Fatihullah Noory - avatar
1 Respuesta
+ 6
I came here to explain it, cuz I dont code in C++ Polymorphism - It is a concept in programming that requires an object / function that can have different use conditionally. Since I code in Rust heres what it looks like fn main() { trait { fn greet(&self) -> str { }; } if lang == "english" { fn greet(&self) -> str { println!("Hello"); } } else if lang == "Spanish" { fn greet(&self) -> str { println!("Hòla!"); } } greet(); } Please correct me if I am wrong
7th May 2017, 4:33 AM
Complex
Complex - avatar