Why we need new operator in java at the time of object
declaration and why not in c++?
Answer Posted / anuja joshi
The major difference between Java and C++ is the behavior of object variables. In C++, object variables hold values, not object references. Note that the new operator is never used when constructing objects in C++. You simply supply the construction parameters after the variable name.
Point p(1, 2); /* construct p */
If you do not supply construction parameters, then the object is constructed with the default constructor.
Time now; /* construct now with Time::Time() */
This is very different from Java. In Java, this command would merely create an uninitialized reference. In C++, it constructs an actual object.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
what is the difference between uservariables and systemvariables (in Environmental variables)???
What are the tasks performed by a Team Lead
How to merge Action Form with Dyna Action Form in Struts.
through which algorithm does the garbage collector works? how the garbage collector will understand that the object will going to be deleted?
Tips for blog integration by www.esteemwebsolutions.com. Can Any body suggest me to how to make wonderful questions on web integration..
can we use commit,rollback in triggers and how?
i want to improve my english vocab for racking campus written exam plz tell me best book for prepration......
I HAVE DONE TESTING TOOLS COURSE,NOW I AM FRESHER,I AM NOT GETTING ANY CALLS,I WANT TO DO THE PROJECT ,WHERE I HAVE TO MEET TO DO THE PROJECT,I AM GOING WITH FAKE EXPERIENCE,SO WHAT I HAVE TO DO.
Hi Guys, This is Rama, right now I am working as a Software Test Engineer in Gurgoan and I have over all 3 years of testing expoeriance. Right now I am looking for a change. Can any body help me out to find a job in south india. Thanks in Advance
Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.
What is the use of Differ interface check box in Ship confirm?
Display names and numbers of employees who have 5 years or more experience and salary less than Rs.15000 using array of structures (name, number, experience and salary)
I want sample papers for NIC Examination. Plz send them to my mail Id das.neelam@gmail.com . Plz send it today, tomorrow i've the exam.
hai i am prasanna.I am MCA 2009 fresher.tell me about certifications.which certification helps me to improve my carrier and to get a technically oriented job ,which certification helps to get job faster.
how can we maintain the previous version scripts to new version.