I got this error :
error: no matching function for call to 'Company::Company(Company*)'
145 | noexcept(noexcept(::new((void )__p) | ^~~~~~~~~~~~~~~~~~ 146 | _Up(std::forward<_Args>(__args)...))) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Test.cpp:20:5: note: candidate: 'Company::Company(int, int)' 20 | Company(int companyId,int value):companyId(companyId),value(value){ | ^~~~~~~ Test.cpp:20:5: note: candidate expects 2 arguments, 1 provided Test.cpp:9:7: note: candidate: 'constexpr Company::Company(const Company&)' 9 | class Company{ | ^~~~~~~ Test.cpp:9:7: note: no known conversion for argument 1 from 'Company' to 'const Company&' Test.cpp:9:7: note: candidate: 'constexpr Company::Company(Company&&)' Test.cpp:9:7: note: no known conversion for argument 1 from 'Company*' to 'Company&&'
The shared pointer gives me an error, I have no idea what the reason is, any idea please?
Code:
#include <iostream>
#include <string>
#include <memory>
using namespace std;
class Company{
public:
int companyId;
int value;
int HighestSalaryEmployee;
int highestSalary;
int LowestIDHighestSalaryEmployee;
int lowestSalary;
int numEmployees;
public:
Company(int companyId,int value):companyId(companyId),value(value){
HighestSalaryEmployee=11;
highestSalary=0;
LowestIDHighestSalaryEmployee=112;
numEmployees=0;
}
};
int main()
{
shared_ptr<Company> ptr1 = make_shared<Company>(new Company(123456,100));
}