+ 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
3 ответов
+ 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
+ 3
show the code mate, what is inside the class?, why do you want to compare it to int??
+ 2
Paul here it is .. the idea is using polymorphism little bit