H
Hoang Do
I have a curious question and I am sure someone else must have run into it
before.
Is it a problem with the collections class or am I misunderstanding the
keyword "Overide".
why does this compile:
----------------------------------------------------
using System;
class test {
abstract class eng
{
public eng(){}
virtual public void calc()
{ Console.WriteLine("Base");}
}
class derivedFrom : eng
{
public derivedFrom(){}
override public void calc()
{ Console.WriteLine("Derived 1");}
}
static void Main() {
derivedFrom xx=new derivedFrom();
xx.calc();
}
}
----------------------------------------------------
and this won't:
----------------------------------------------------
using System;
class test {
class col : System.Collections.CollectionBase {
public col() {}
override public void RemoveAt(int index)
{
Console.WriteLine("RemoveAt");
}
}
static void Main()
{
col x = new col();
col.RemoveAt(0);
}
}
Hoang Do, (e-mail address removed)
before.
Is it a problem with the collections class or am I misunderstanding the
keyword "Overide".
why does this compile:
----------------------------------------------------
using System;
class test {
abstract class eng
{
public eng(){}
virtual public void calc()
{ Console.WriteLine("Base");}
}
class derivedFrom : eng
{
public derivedFrom(){}
override public void calc()
{ Console.WriteLine("Derived 1");}
}
static void Main() {
derivedFrom xx=new derivedFrom();
xx.calc();
}
}
----------------------------------------------------
and this won't:
----------------------------------------------------
using System;
class test {
class col : System.Collections.CollectionBase {
public col() {}
override public void RemoveAt(int index)
{
Console.WriteLine("RemoveAt");
}
}
static void Main()
{
col x = new col();
col.RemoveAt(0);
}
}
Hoang Do, (e-mail address removed)