#include <iostream>
#include <string>
class Person {
private:
std::string name;
int age;
public:
Person(const std::string& n, int a) : name(n), age(a) {}
// Copy constructor
Person(const Person& other) : name(other.name), age(other.age) {
std::cout << "Copy constructor called" << std::endl;
}
void display() const {
std::cout << "Name: " << name << ", Age: " << age << std::endl;
}
};
int main() {
Person p1("Alice", 30);
Person p2 = p1; // Copy constructor called
std::cout << "Person 1: ";
p1.display();
std::cout << "Person 2: ";
p2.display();
return 0;
}