Hi I've had this issue before with another program, but I'm not sure why this is occurring again. I've changed some code around and the error is the same regardless. The error is on line 67 and is "expression must have class type for cup.toString() and cup.size() . Thanks ahead of time. Am I declaring my class incorrectly? I still haven't quite got the hang of classes yet. Also ignore the endl; sections, I meant to switch them to /n, but haven't gotten to it yet.
Thanks ahead of time and hope I gave enough details.
What are you trying to do here? This doesn't do it. This is a function declaration for a function called cup which returns a type coffeeCup and takes 4 parameters.
It looked to me like he was trying to create a constructor. I did the same thing once with a constructor, and my teacher couldn't figure out what the heck I was trying to do.
Oops. On line 65, he has a call to cup(). You're right, seeplus. I will edit my post (just so he doesn't get confused).
No wait, that's not a call, that's a...function prototype? I'm confused now...
Ok, this is weird.
kg88 wrote:
The error is on line 67 and is "expression must have class type for cup.toString() and cup.size().
@kg88,
So, on line 67, you call cup.toString() and cup.size(). Where are the function definitions for those? Or are you using the <string> library?
I'm sorry for the confusion everyone. Also I got caught up in some things and was unable to get back to my computer to respond in a timely manner. Sorry about that too. The assignment is asking me to create a vector with coffee cups where I can select a cup and pour, sip, get the contents, etc for the cups created. I have had some students mention that I should try to put more of my functions in the header files rather than in the main code, so I've been working at doing so, but I'm terrible with vectors ( and c++ in general) and the class I'm taking is moving too fast for me to really understand what I'm actually doing ( just doing the assignments takes me 10+ hours to figure out). At this point, I'm just trying to get the program to somewhat work so that my prof can at least run it.
Thanks for the feedback, it helps so much getting others inputs.
I'm sorry my coding is so terrible, I'm honestly confused with it myself. I like to take my time learning stuff like this and fast paced on this kind of stuff usually turns as poorly for me because I'm combining too many things without really understanding each piece clearly