Skip to content

Instantly share code, notes, and snippets.

@gcs-abdulwahab
Created October 12, 2023 04:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gcs-abdulwahab/692d25e611eee7184f0b15ca4011a3e4 to your computer and use it in GitHub Desktop.
Save gcs-abdulwahab/692d25e611eee7184f0b15ca4011a3e4 to your computer and use it in GitHub Desktop.
Person Defacult Copy Constructor
#include <iostream>
using namespace std;
class Person
{
private :
int x;
int y;
public:
Person(int x, int y)
{
this->x = x;
this->y = y;
}
void display()
{
cout << "( " << x << " , " << y << " )";
}
};
int main()
{
Person p1(2, 3);
Person p2 = p1;
p2.display();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment