Say I have the following line:
Nothing *here = &doing;
My nothing class is just this:
class Nothing
{
};
I need to explicitly provide what the compiler implicitly provides. So
basically I need fill in my nothing class with the function that the
above line will call and I have no clue! I have the first three lines
in Main figured out, it's just the last two that I need help with. Here
is what I have so far with the other things for this class
Nothing.h =============== =========
class Nothing
{
public:
Nothing()
{
cout << "Executing the default constructor ========>" << endl;
}
Nothing(const Nothing&)
{
cout << "Executing the copy constructor =============== ====>" <<
endl;
}
Nothing& operator=(const Nothing &rhs)
{
cout << "Executing the assignment operator =============== =>" <<
endl;
return *this;
}
};
Nothing.cpp =============== =============== ===========
#include "nothing.h"
int main()
{
const Nothing ness;
Nothing doing(ness);
doing = ness;
Nothing *here = &doing;
const Nothing *anywhere = &ness;
return 0;
}
-Jason
Nothing *here = &doing;
My nothing class is just this:
class Nothing
{
};
I need to explicitly provide what the compiler implicitly provides. So
basically I need fill in my nothing class with the function that the
above line will call and I have no clue! I have the first three lines
in Main figured out, it's just the last two that I need help with. Here
is what I have so far with the other things for this class
Nothing.h =============== =========
class Nothing
{
public:
Nothing()
{
cout << "Executing the default constructor ========>" << endl;
}
Nothing(const Nothing&)
{
cout << "Executing the copy constructor =============== ====>" <<
endl;
}
Nothing& operator=(const Nothing &rhs)
{
cout << "Executing the assignment operator =============== =>" <<
endl;
return *this;
}
};
Nothing.cpp =============== =============== ===========
#include "nothing.h"
int main()
{
const Nothing ness;
Nothing doing(ness);
doing = ness;
Nothing *here = &doing;
const Nothing *anywhere = &ness;
return 0;
}
-Jason
Comment