I have finals tomorrow and I'm still having some problems with classes. It's 4 in the morning and I have a test at 7:30 and still trying to go over it. I'm looking over the review now. Please help me with this question.
He wants to know what the output would be. He likes to trick people so I'm getting more and more confused. I would say this program would fail. I understand that this isn't a whole program but I don't think this makes sense. Will someone please... reassure me?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
class catType
{
private:
int x;
public:
cat(){x=10; cout<<"Meow"<<endl;}
~cat(){cout<<x<<" Meow again"<<endl;}
}
void fun()
{
catType myCat;
}
int main ()
{
fun();
return 0;
}
But because the fun() functions only creates an instance of the class. There would be no output? As your not calling the functions to display the "meow" etc
Thats what I thought Mythios.. but I'm not sure.. he tends to use the exact same problems from the review so I wanted to make sure.. but I guess if he does use the same exact same problem, I'll just write the program will not run because he forgot the ; and I will still be right.. :) right? haha
A semicolon is missing. Is the point of the question really just to spot the missing semicolon? "Well you see, the class definition is missing a semicolon. That was the answer to the question. Didn't you get it? HA!" I hate questions like that. I thought compilers were built to deal with such details.
I have finals tomorrow and I'm still having some problems with classes...
He wants to know what the output would be. He likes to trick people so I'm getting more and more confused. I would say this program would fail.
You really should write "This program is an EPIC FAIL" on the paper. That would be funny.