+ 3

SOLVE How to use if statement with class objeck (not class n object)?

class obj ; How to if statement this one with integer. thanks https://code.sololearn.com/cuWZDIX7NG6S/?ref=app

29th Aug 2018, 1:56 PM
Muhamad Fathi Zuhaili
Muhamad Fathi Zuhaili - avatar
3 Answers
+ 2
https://code.sololearn.com/cVCGzoubcIGR/?ref=app Here you go. You can get the variable inside the object bu using a dot operator (as long as it is public). Thos is not polomophism just yet. Polimorphism occurs when a class inherits from another class and then you can use that base class to point to that derived class because of polimorphism. There are plenty of very good examples online so there is no need to make another one, just google for it, hope it helps
30th Aug 2018, 9:25 AM
Paul
+ 3
show the code mate, what is inside the class?, why do you want to compare it to int??
29th Aug 2018, 3:01 PM
Paul
+ 2
Paul here it is .. the idea is using polymorphism little bit
30th Aug 2018, 3:49 AM
Muhamad Fathi Zuhaili
Muhamad Fathi Zuhaili - avatar