I had an exam in my college on objected-oriented programming. One of the questions was about static binding and dynamic Binding.
The question was as follows:
Shape s; if(i==1) s = new Point(1,2); else s = new Rectange(10,20); //this is dynamic binding.
YES/NO
it's not my answer btw.
My teacher said the answer is "no" because it's static binding.
As I know static binding and dynamic binding happen only when I call methods. I read all the StackOverflow questions and a lot of blog posts about this topic and the only answer I can come up with is that there is dynamic binding.
Any explanation will be appreciated.