Computer Science, asked by Tusharbhardwaj, 1 year ago

why is an object not passed to a constructor by value ?Explain

Answers

Answered by nitish8089
8
actually when we are passing the actual-argument by value then the formal-argument(recieve by method) it will create an copy of that argument and allocate the new memory block... so any change in the formal-argument does not affect actual argument...

so making a copy(pass by value) of argument is good idea for only small memory but object needed so big-amount of memory block.... though it's not good coding practice......to consume so many memory.. so we are just pass by refernce to object now what ever we want to evaluate just acess by same memory block.. (no new copy build ) less memory busy...

now question is arise when we pass by reference so any change in formal-argument would affect actual-argument so how can restrict just make the formal argument constant.


may this will help you...
Similar questions