Hi Winston,
I am clear with my 2nd Question answer.
1. What is the rule for creating Covariant Return Type overriding?
Answer: the return types of the overriding methods [must] be subtypes of the return type of the overridden method
I know it's damn silly , but I really didn't understand the meaning of the sentence.
Let me elaborate it,
overriding methods meaning : Here from my above example, B print1() method = inside class B is Overriding method. It should return B class object.
overridden method meaning : A print1() method = inside Class A. It should return Class A Object or constructor but I am returning class B constructor.
Now if the above two are correct then just want to know; what is the meaning of " overriding methods [must] be subtypes ". What is that subtypes mean?
I am sorry for confusing you.
My 3rd Question is : whether Covariant Return Type would be class constructors or objects only? or it could be primitive data types like int,void etc...?
Example , I gave print1() with class A or class B return type...whether it could be int or float etc?
Regards,
Sharmistha