User Profile

Collapse

Profile Sidebar

Collapse
prasoonsaurav
prasoonsaurav
Last Activity: Apr 25 '10, 04:14 AM
Joined: Dec 25 '09
Location: India
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Please show the complete code.

    If 'p' is a pointer to an integer and if it has been properly initialized then both (1) and (2) print the values at the addresses being pointed to by 'p'.

    Make sure that you have properly initialized 'p', otherwise the behaviour is undefined.
    See more | Go to post

    Leave a comment:


  • Frankly speaking there is no logical need to reconstruct the object but that's how C++ is designed to work.



    In cases where dynamic memory allocation is performed even though compiler will provide a copy constructor and assignment operator, the memory must be allocated and deallocated manually(so you have to write your version of copy constructor and assignment operator considering dynamic memory allocation).
    ...
    See more | Go to post

    Leave a comment:


  • This is because std::vector requires its objects to be assignable. Declaring your string as "const" won't allow assignment operation to be performed on the vector object.



    vObj.push_back( s);involves an implicit cast of s to Test. So what's actually happening is vObj.push_back( Test(s)); and the temporary object gets destroyed after it is copied into the vector.

    The object within the vector is constructed...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...