I am trying to create own manipulator, which will add the extra tab with input. Please find when I run the below program I got below mentioned error. could you please anybody help me, what is the wrong with the code?
Code:
#include <iostream>
#include <cstdlib>
using namespace std;
class addtab
{
addtab()
{
cout << "constructer has called" << endl;
}
~addtab()
{
cout << "destructer has called" << endl;
}
public:
friend ostream& operator<<(ostream& ,int&);
};
ostream& operator<<(ostream &os,int &n)
{
return os ;
}
int main()
{
int n;
n = 7;
cout << "this " << addtab(n) << endl;
}
when I run this program, I am getting below mentioned error? please help me to clear my error.
create_own_manu.cpp: In function `int main()':
create_own_manu.cpp:30: no matching function for call to `addtab::addtab(int&)'
create_own_manu.cpp:7: candidates are: addtab::addtab(const addtab&)
create_own_manu.cpp:10: addtab::addtab(
)
Comment