Explain the use of this pointer.
Latest answer: The this keyword is used to represent an object
that invokes the member function. It points to the object for which this
function was called. It is automatically passed to a member function when it is
called....................
Read answer
Explain what happens when a pointer is
deleted twice.
Latest answer: If you delete a pointer and set it to NULL, it
it possibly cannot have an adverse effect. It is safe. However, if a pointer is
deleted an not nullified, then it can cause a trap....................
Read answer
What is a smart pointer?
Latest answer: Smart pointers are objects which store pointers
to dynamically allocated (heap) objects. They are like built-in C++ pointers.
However, they automatically delete the object pointed to at the appropriate
time...................
Read answer
What is the difference between an inspector
and a mutator?
Latest answer: The get() functions are usually refered to as
inspectors as that just retrieve the data values from the
source.....................
Read answer
What is pointer? Explain with examples
Latest answer: A pointer is a variable that holds a memory
address. This address is the location of another object (typically, a variable)
in memory. That is, if one variable contains the address of another variable,
the first variable is said to point to the second...................
Read answer
Pointer to constant vs.
pointer constant
Latest answer: Pointer Constant (or constant pointer) is a
pointer which you don’t want to be pointed to a different value. That is, the
location stored in the pointer can not change. We can not change where the
pointer points. It is declared as:....................
Read
answer
What are function pointers?
Latest answer: A function has a physical location in the memory
which is the entry point of the function. And this is the address used when a
function is called. This address can be assigned to a pointer. Once a pointer
points to a function, the function can be called through that pointer. Function
pointers also allow..................
Read answer
What is pointer to member?
Latest answer: not to a specific instance of that member in an
object. This type of pointer is called a pointer to a class member or a
pointer-to-member. It is not same as normal C++ pointer. Instead it provides
only an offset into an object of the member’s class at which that member can be
found. Since member....................
Read answer
What is const pointer and
const reference?
Latest answer: const pointer is a pointer which you don’t want
to be pointed to a different value. That is, the location stored in the pointer
can not change. We can not change where the pointer points. It is declared
as:..................
Read
answer
What is NULL pointer and void
pointer and what is their use?
Latest answer: A NULL pointer has a fixed reserved value that
is not zero or space, which indicates that no object is referred. NULL pointers
are used in C and C++ as compile-time constant. NULL pointer represents certain
conditions, like successor to the last element in linked list, while a
consistent structure of the list of nodes are maintained......................
Read answer
|