Sorry......
//myclass.cs
MyClass {
public int a;
public void swapl(ref x, ref y) {
int temp;
temp = x;
x = y;
y = temp;
}
}
//myclass.cs
MyClass {
public int a;
public void swapl(ref x, ref y) {
int temp;
temp = x;
x = y;
y = temp;
}
}
To copy to clipboard, switch view to plain text mode
Class Program {
.........................................
static void Main(string[] args) {
System.Int32 i = 99, u = 10; // 1
MyClass simple = new MyClass(); //2
simple.swap (i,u); //XX
Address a = new Address("x", 10); // 3
}
}
Class Program {
.........................................
static void Main(string[] args) {
System.Int32 i = 99, u = 10; // 1
MyClass simple = new MyClass(); //2
simple.swap (i,u); //XX
Address a = new Address("x", 10); // 3
}
}
To copy to clipboard, switch view to plain text mode
//1 - value type; allocate on the stack because local variabile of a function (call
function)
//2 - ref type; local class; it'll die with end of main(); on the stack of main () ????
//3 - value type - local struct; on the main () 's stack.
Now: when the application arrival to execute //XX inside main(), everything inside Myclass::swap goes on the stack (I hope). But why? because is it inside main() function or because is it a call function, independently from where it is?
Then: where is allocated Program class??? Who create an instance of Program??
thanks
Bookmarks