I've some abstract class known as IClass (has pure virtual function). You will find some classes which inherit IClass: CFirst, CSecond. I wish to add objects of classes which inherit into boost::ptr_vector:

class IClass { virtual void someFunc() = 0; };
class CFirst : public IClass { };
class CSecond : public IClass { };

boost::ptr_vector<IClass> objectsList;

objectsList.push_back(new CFirst());
objectsList.push_back(new CSecond());

And today let me call function (that is declarated in IClass) all objects in objectsList. I'd would rather use BOOST_FOREACH:

foreach(IClass tempObj, objectsList)
{
    tempObj.someFunc();
}

However , IClass - abstract class, and so i can't make demonstration of it for that foreach-cycle. What must i do?

Make use of a mention of the IClass rather:

foreach(IClass& tempObj, objectsList)
{
    tempObj.someFunc();
}