no polymorphism with references ?
I am not sure why the following does not work
class obj {...}
class rocks : obj {...}
static int func(ref obj [] list) {...}
static void Main(string[] args)
{
rock []rocks = new rock[10];
{...} //initialize
func(ref rocks).ToString());
}
it returns the error: "[...] Argument '1': cannot convert from 'ref Polymorphism_ref_test.Class1.rock[]' to 'ref Polymorphism_ref_test.Class1.obj[]'"
but this does (the difference is that the argument is not a reference anymore):
class obj {...}
class rocks: obj {...}
static int func(obj [] list) {...}
static void Main(string[] args)
{
rock []rocks = new rock[10];
{...} //initialize
funk(rocks);
}
can anyone tell me why this does not work ?
bilnaadPosted Nov 17, 2004, 3:43 PM
kuantanzai-sfPosted Nov 17, 2004, 1:45 PM
loogelPosted Oct 30, 2004, 4:43 PM
bilnaadPosted Oct 30, 2004, 11:22 AM
loogelPosted Oct 30, 2004, 3:03 AM
Andrzej WegierskiPosted Oct 30, 2004, 2:06 AM
bilnaadPosted Oct 29, 2004, 7:22 PM
loogelPosted Oct 29, 2004, 6:55 PM
loogelPosted Oct 29, 2004, 6:53 PM
bilnaadPosted Oct 29, 2004, 4:57 PM
loogelPosted Oct 29, 2004, 4:12 PM
bilnaadPosted Oct 29, 2004, 6:24 AM