Why this code showing uninitialized/garbage value? It's showing correct value when the field name and constructor parameters not identical.
#include<bits/stdc++.h>
using namespace std;
class Employee {
public:
     Employee(string name,string company,int age)
     {
         name = name;
         company = company;
         age = age;
     }
     string name;
     string company;
     int age;
     void IntroduceYourself()
     {
         cout<<name<<' '<<company<<' '<<age<<endl;
     }
};
int main()
{
    Employee employee1= Employee("Saldina","Codebeauty",25);
    employee1.IntroduceYourself();
    Employee employee2 = Employee("John","Amazon",35);
    employee2.IntroduceYourself();
    return 0;
}
 
    