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 are the tasks performed by a Team Lead
what will we require to build project with the help of oracle
Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming
I want to pass .pdf files as OlE Object to crystal report through VB6. Please any one guid me...
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.
can we retrieve only integer/String type columns from a table,if yes how?
Which language they use during interview?
Write a pseudo code to evaluate a number to any base given (2...16) based on the input. Number greater than 9 should be given as A-F for 10-15.
there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box. eg: 3 box contain stick as:1,1,1. if u take 1 stick from 3rd numbred box you will any how win the match.
In JCl , we have COND parameter.This holds comparison code and condition.It also has only and even parameters. ex: COND((4,GE),EVEN).what the comma mean here. is that 'and' or 'or'.
Why did you ever become involved in QA/testing?
What is SOLID Principle in Programming Language?
write the a cl program with the following specification A. Accept 2 parameters-date and date type B. if date type is J then convert date to *MDY format C. if date type is M convert date to *JUL format 4.send a program message with the value of converted date Please explain for each with coding?
Always use scope terminator like End-If with IF, End- Evaluate with Evaluate statement.Can somebody explain me the detail logical explanation?
how to hide prompts