+ 1
Why I'm I getting default value after using the same object reference variable?
In the first I have used new Facebook it gives me the expected output but after using same object reference variable I'm getting default value. Has i come to know that the used object reference will get override so I'm getting default value.! But why I'm not getting default value when I'm using new.! New keyword is used to create a new memory block so the old memory also should over ride.! It's bit confusing for me can anyone please help Mee..! https://code.sololearn.com/cBdqWeIMpd0Q/?ref=app
2 ответов
+ 1
ref=new FaceBook(10); // This will create a new object into ref reference so old object referenced by ref will be overridden. And you are not assigning any values to new object so it returing default values
+ 1
Thanks bro👍