
I tried this code on code block and it works, but it gives me a problem in visual studio. I don't know where exactly the problem is. The error I get is:
no instance of constructor "book::book" match the argument list
Updated code:
#include<iostream>
#include<cstring>
using namespace std;
class book
{
private:
    int npage;
    char title[30];
public:
    book(char t[], int p = 33)
    {
        npage = p;
        strcpy_s(title, t);
    }
    book(book&a)
    {
        npage = a.npage;
        strcpy_s(title, a.title);
    }
    void p()
    {
        cout << "page : " << npage << endl << "title : " << title << endl;
    }
};
int main()
{
    char c[30] = "rich dad poor dad";
    book a1(c, 260);
    book a2(a1("rich dad poor dad", 260));
    a1.p();
    system("pause");
}
 
     
    