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 a statement just declared reference variable without assignment. and classB a = new classB(); is a statement with assigment