LANGUAGES | C++ | C++ INTERVIEW QUESTION AND ANSWERS | 10

C++ Interview

C++ Interview Question and Answers:

46. What are the differences between new and malloc?
         New initializes the allocated memory by calling the constructor. Memory allocated with new should be released with delete.
    Malloc allocates uninitialized memory.
    The allocated memory has to be released with free.new automatically calls the constructor while malloc(dosen’t)

47. What is this pointer?
      It is a pointer that points to the current object. This can be used to access the members of the current object with the help of the arrow operator.

48. What is conversion operator?
      You can define a member function of a class, called a conversion function, that converts from the type of its class to another specified type.

49. What is encapsulation?
      Encapsulation (or information hiding) is the process of combining data and functions into a single unit called class.

50. What is problem with Runtime type identification?
      The run time type identification comes at a cost of performance penalty. Compiler maintains the class.

No comments:

Post a Comment