I am a bit confused with the binding type of a constructor. Why is calling
Canvas c = new Circle();
not dynamic binding?
Thank you!
I am a bit confused with the binding type of a constructor. Why is calling
Canvas c = new Circle();
not dynamic binding?
Thank you!
It is static binding as it is done during compile time.
If class Circle has a method that overrides a method from Canvas and you call that method like the following, then it is called dynamic binding.
//if you override some method in the child class that is Circle
c.someMethod() //example of dynamic binding
You can read static vs dynamic for more.