#includeIn this example, we create a QPtrList of pointers to MyClass objects and add some elements to it using the `append()` method. We then iterate over the list using a `QPtrListIterator`, which returns pointers to the objects. Next, we remove the first and last elements using the `takeFirst()` and `takeLast()` methods, respectively. Finally, we clear the list and delete all its elements using the `clearAndDelete()` method. QPtrList is part of the Qt Core module, which is a part of the Qt library.class MyClass { /* ... */ }; int main() { // Create a QPtrList of pointers to MyClass instances QPtrList myList; // Append some objects to the list myList.append(new MyClass); myList.append(new MyClass); myList.append(new MyClass); // Iterate over the list and print some information QPtrListIterator it(myList); while (it.hasNext()) { MyClass* obj = it.next(); std::cout << "Object at " << obj << std::endl; } // Remove the first and last elements myList.takeFirst(); myList.takeLast(); // Clear the list and delete all its elements myList.clearAndDelete(); return 0; }