I was trying to return value true or false depending upon the condition by using a conditional operator but I got an error. Here is my code,
bool isEmpty() {
Unless you have a deeper reason for doing this that I am missing, you should just return (listSize > 0);.
return (listSize > 0);