Can anyone explain what is the difference between object vs instance vs reference, with a good example?
I'm confused about this part:
( classA a;
a = new classA(); )( classA a;
a = new classB(); )( classA a;
classB a = new classB(); )
Can anyone explain what is the difference between object vs instance vs reference, with a good example?
I'm confused about this part:
( classA a;
a = new classA(); )
( classA a;
a = new classB(); )
( classA a;
classB a = new classB(); )
classA a
is a reference variable.
new classA();
created Object / Instance
a = new classB()
is assign object reference to variable
ClassA a is reference
a = new ClassA() a object os asign reference to variable
2 a = new classB() is pass the reference of classB
3 Here classA is override becauseeyou set same same name of reference