Whether it's a bird or a lamp

  • 3
  • Locked
What do birds and lamps have in common? The fact that birds and lamps can both be objects of their respective classes. And objects can be passed into methods as arguments. In this task, we are going to write a method that determines the type of the object passed to it, and then displays the appropriate message. Cat, Dog, Bird, and Lamp.
You can't complete this task, because you're not signed in.
Comments (3)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Roman Grygorczuk
Level 19 , Cracow, Poland
2 November 2020, 11:49
this one was very hard for me actually, and I still not confident at all while passing method parameters or so... Can you recommend any good article with examples? Thanks in advance!
Devonte A
Level 18 , Rubery, United Kingdom
28 June 2020, 08:53
Tip - Revise "instance of" :)
Kent Hervey Software Engineer/Consult at Zeal IT ConsultantsExpert
7 May 2020, 21:29
Be careful with this. The method they taught us to use and that works, also yields true if an Reference or Declared types are true.