Click here to Skip to main content
15,890,385 members
Home / Discussions / C#
   

C#

 
AnswerRe: Dynamic Casting? Pin
I#3-Mar-04 1:49
I#3-Mar-04 1:49 
AnswerRe: Dynamic Casting? Pin
HAHAHA_NEXT3-Mar-04 4:19
HAHAHA_NEXT3-Mar-04 4:19 
GeneralRe: Dynamic Casting? Pin
leppie3-Mar-04 6:10
leppie3-Mar-04 6:10 
GeneralRe: Dynamic Casting? Pin
HAHAHA_NEXT3-Mar-04 6:15
HAHAHA_NEXT3-Mar-04 6:15 
QuestionIs there a difference? Pin
sps-itsec462-Mar-04 11:48
sps-itsec462-Mar-04 11:48 
AnswerRe: Is there a difference? Pin
RNEELY2-Mar-04 11:58
RNEELY2-Mar-04 11:58 
AnswerRe: Is there a difference? Pin
Heath Stewart2-Mar-04 12:26
protectorHeath Stewart2-Mar-04 12:26 
AnswerRe: Is there a difference? Pin
Colin Angus Mackay2-Mar-04 12:28
Colin Angus Mackay2-Mar-04 12:28 
Okay... Here's a question for you...

[Edit]
Ooops! The original version of this program had an error in it that I didn't intend. Here is the correction, the multiple choice answers were as before.
[/Edit]

What is the output of this program:

01: class App
02: {
03:     int i1 = 0;
04:     int i2 = 0;
05: 
06:     public void Method1()
07:     {
08:         i1 = 2;
09:         i2 = 3;
10:     }
11: 
12:     public void Method2(int i2)
13:     {
14:         i1 = i2;
15:     }
16: 
17:     public static void Main()
18:     {
19:         App a = new App();
20:         a.Go();
21:     }
22:
23:     public void Go()
24:     {
25:         Console.WriteLine("i1 = {0}, i2 = {1}", i1, i2);
26:         Method1();
27:         Console.WriteLine("i1 = {0}, i2 = {1}", i1, i2);
28:         Method2(5);
29:         Console.WriteLine("i1 = {0}, i2 = {1}", i1, i2);
30:     }
31: }


Is it:
a)
i1 = 0, i2 = 0
i1 = 2, i2 = 3
i1 = 3, i2 = 3

b)
i1 = 0, i2 = 0
i1 = 2, i2 = 3
i1 = 5, i2 = 3

c)
i1 = 0, i2 = 0
i1 = 2, i2 = 3
i1 = 5, i2 = 5

d)
None of the above - it generates a compiler error on line 12


EuroCPian Spring 2004 Get Together[^]
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar


GeneralRe: Is there a difference? Pin
boogs2-Mar-04 13:08
boogs2-Mar-04 13:08 
GeneralRe: Is there a difference? Pin
boogs2-Mar-04 13:13
boogs2-Mar-04 13:13 
GeneralRe: Is there a difference? Pin
Dave Kreskowiak2-Mar-04 13:33
mveDave Kreskowiak2-Mar-04 13:33 
GeneralRe: Is there a difference? Pin
Colin Angus Mackay2-Mar-04 13:38
Colin Angus Mackay2-Mar-04 13:38 
AnswerRe: Is there a difference? Pin
Meysam Mahfouzi2-Mar-04 17:55
Meysam Mahfouzi2-Mar-04 17:55 
GeneralRe: Is there a difference? Pin
sps-itsec463-Mar-04 8:48
sps-itsec463-Mar-04 8:48 
GeneralRe: Is there a difference? Pin
Meysam Mahfouzi3-Mar-04 17:27
Meysam Mahfouzi3-Mar-04 17:27 
GeneralHELP with Code Access Security! Pin
Throckmorton2-Mar-04 11:10
Throckmorton2-Mar-04 11:10 
GeneralRe: HELP with Code Access Security! Pin
Heath Stewart2-Mar-04 12:19
protectorHeath Stewart2-Mar-04 12:19 
GeneralRe: HELP with Code Access Security! Pin
Throckmorton2-Mar-04 13:58
Throckmorton2-Mar-04 13:58 
GeneralRe: HELP with Code Access Security! Pin
Throckmorton2-Mar-04 17:23
Throckmorton2-Mar-04 17:23 
GeneralRe: HELP with Code Access Security! Pin
Heath Stewart3-Mar-04 3:27
protectorHeath Stewart3-Mar-04 3:27 
GeneralRe: HELP with Code Access Security! Pin
Throckmorton3-Mar-04 9:19
Throckmorton3-Mar-04 9:19 
GeneralRe: HELP with Code Access Security! Pin
Heath Stewart3-Mar-04 9:27
protectorHeath Stewart3-Mar-04 9:27 
GeneralRe: HELP with Code Access Security! Pin
Throckmorton3-Mar-04 10:11
Throckmorton3-Mar-04 10:11 
GeneralRe: HELP with Code Access Security! Pin
Heath Stewart3-Mar-04 10:16
protectorHeath Stewart3-Mar-04 10:16 
Generalproblems in running app at win startup Pin
visiontec2-Mar-04 10:22
visiontec2-Mar-04 10:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.