What is the output of following code?
a) xCode:int fn () {return 5;} class B { private: static const int x = fn(); static const double d = 2.0; }; int main () { }
b) d
c) x and d
d) none
What is the output of following code?
a) xCode:int fn () {return 5;} class B { private: static const int x = fn(); static const double d = 2.0; }; int main () { }
b) d
c) x and d
d) none
stop posting your homework for us to do for you. this isn't that kind of board. Homework Policy
i think it's none? what do you say?
Why do you think none is the answer?
Jim
If you want an answer, then you must give us an answer. We don't require that you be right, only that you state your reasoning. By understanding your reasoning, we can correct it if necessary and help you figure out the answer, thereby giving you more useful information than just an answer.
What does being a Windows expert or not have anything to do with this question? This is a question based on standard C++, the answer will be the same if I'm using Windows, OSX, Linux, DOS, or any other operating system. If they have a standard compliant compiler the answer will be the same. This question can easily be answered by compiling the code and observing the output.
Jim
6 new threads in the space of a few hours, all with urgent in the title.
If these had been your first 6 posts (and not a member with some track record), I would have deleted all of them as some selfish "me me me" prat.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Bwahaha!6 new threads in the space of a few hours, all with urgent in the title.
I didn't realize they were all by the same game.
Now my urgent post just looks silly.
Soma
while running with online compiler, i got below error...pls help
Line 1: error: 'int fn()' cannot appear in a constant-expression
compilation terminated due to -Wfatal-errors.
You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.
So you get an error message, does any of your choices include an error message?
If you get an error message can a, b, or c ever happen? Remember when you get an error message your program will not run, therefor it produces no output.a) x
b) d
c) x and d
d) none
Jim