• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt with compiler error about method matching

 
Ada Lopez
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends!

I was studying K&B´s Overloading Made Hard section in Chapter 3.
There´s no problem with this code:


a
But then I wondered which one of these two would pick if they were overloaded and surprise!!! It gives a compiler error (ambiguous, both method match) and I don´t understand why the compiler can´t choose:



Please, anyone knows why?
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go through this topic. From the rules listed out by Anand, read the 4th rule...
 
Ada Lopez
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks so much!! This is what I was looking for!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic