Monday, November 21, 2005

C++: What is Slicing problem?

This makes a clear explanation!

CPlusPlus Gems

3 comments:

  1. If u assign a derived class object to a base class object and try to assess the derived class member using the base class object then slicing problem arrises.

    Because all the derived class attributes are out of the scope of base class object

    Kr,
    Muthu

    ReplyDelete
  2. Anonymous2:58 AM

    But this slicing problem occurs when we pass the arguments by value. This problem can be avoided by passing the argument by reference.

    ReplyDelete
  3. Anonymous3:01 AM

    when we pass the argument by value the slicing problem occurs. This can be avoided by passing the arguments by reference.

    Regards,
    Bhanu.

    ReplyDelete