i created a book class that I am working on as part of my assignment, but it seems to have one problem that I donβt understand in my code below, this is my code
private: Book (string N = " ", int p = 100, string A = "", string P = "", string T = "", int Y = 2000) { cout << "Book constructor start " << N << endl; Title=N; pages=p; Author=A; Publisher=P; Type=T; Yearpublished=Y; } ~Book(void) { cout << "Book destructor start " << Title << endl; system("pause"); } public: static Book * MakeBook(string N = "", int p = 100, string A = "", string P = "",string T = "",int Y = 2000) { return new Book(N,p,A,P,T,Y); } static void DelBook(Book * X) { delete X; }
There is a constructor and destructor in the above code, my question is what happens when I pass NULL as an argument to the stactic void DelBook ? as below
static void DelBook(NULL) { delete NULL; }
How can I compile it if it is possible to pass a NULL value? Thanks in advance.
source share