class Person { public: std::string name; int age; char gender; std::string address; void introduce() { std::cout << "Hello, my name is " << name << " and I'm " << age << " years old." << std::endl; } };
Person people[3]; people[0].name = "Alice"; people[0].age = 25; people[0].gender = 'F'; people[0].address = "123 Main St"; people[1].name = "Bob"; people[1].age = 32; people[1].gender = 'M'; people[1].address = "456 Elm St"; people[2].name = "Charlie"; people[2].age = 19; people[2].gender = 'M'; people[2].address = "789 Oak St"; for (int i = 0; i < 3; i++) { people[i].introduce(); }In this example, we create an array of three Person objects and set their properties accordingly. Then we loop through the array and call the introduce method for each person to print their introductions. The Person class in these examples does not belong to a specific package library - it is a simple example of a class that can be used in a variety of contexts.