Feb 05

A Question from a reader and my Answer

C# | Design Patterns | My Inbox 4 Comments »

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Greetings!

I have a hierarchy of classes, with an abstract class that defines the
method Read() at the top of it. Each class in the hierarchy has a
Read() method, and I need to be able to call Read() from the highest
possible level of the hierarchy and get the correct Read() function.

Public class AbstractClass 
{
abstract void Read();
}

Public class A : AbstractClass
{
public override void Read();
}

Public class B: A
{
public override void Read();
}

The compiler complains that A has no overridable function named Read().
Is it not possible to do this?

Thank you very much.

RobR


[KickIt] [Dzone] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tags:

Comments

Add comment


(Will show your Gravatar icon)  

biuquote
  • Comment
  • Preview
Loading