Hi I've got to write a class called course that makes two objects and has a function that one time has a default value when called and another time sets a value to a grade value. I got it to compile and it uselessly works with shallow copy but why is it segfaulting when I try and add a deep copy constructor to stop the values messing up, Thanks.
The function SetPassingGrade attempts to dereference the pointer PassingGrade. In PaperOne, that pointer was never set to point at anything, so you're trying to dereference random memory. This is bad. This segFaults.
Also, your functions SetPassingGrade don't set anything.
Is it even possible to have a function set a default value deep copy the object and then overload the function to take a new value or am I trying to do something impossible and the tutor just wanted me to use one object so no deep copy or pointers?
You should always avoid pointers when you can. You should always avoid dynamic memory when you can. Did the assignment specifically say to use pointers and write deep copies? If the assignment was just
write a class called course that makes two objects and has a function that one time has a default value when called and another time sets a value to a grade value
then you don't need pointers and you don't need to write your own copy constructors.