The errors which I see are as follows:
PhDsHouse.setFavoritePicture (pRef);
where is pRef
defined in main
? Thus, you are getting error at that statement.
I am guessing, you want to create new Picture
object and then assign it to PhDsHouse
using setFavoritePicture
. Is this true? If yes, you need to do something like Picture pRef = new Picture();
before your setFavoritePicture
... then you should be good.
Also, the following function looks very suspicious to me
public void setFavoritePicture (Picture pRef)
{
pRef = favPic;
}
Should this be
public void setFavoritePicture (Picture favPic)
{
pRef = favPic;
}
because, I do not see where favPic
has been defined/initialized in your code....else you will get NULL pointer exceptions
when you access pRef
as favPic
is NULL
, which will be assigned to pRef
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…