Hello,
I asked a question about interfaces previously and got some excellent responses. I'm really excited to start developing really flexible code.
I now have a question about overriding a virtual method.
I am currently working with the Community Server SDK. One of the controls is a 'tag' bread crumb. So it will list the 'tags' on the relevant object.
<CSBlog:TagBreadCrumb />
I am using tags to allow adminstrators to target specific spots for content to appear in a layout, however those tags are not relevant to the end user. For example, 'Home_Main' tag is used to target the main panel on the home page, but I don't want user to see that.
Since I have the SDK for Community Server, I found the control which renders the 'tag list' and made modifications to it that do what I want - however my understanding is that it's not good to modify the core for many reasons.
So what I'd like to do is create my own control, which is essentially almost 100% identical to the base control, but override one method.
Here is the method:
public virtual string FormatTags(string[] tagList)
Inside of there is code to format the tags, and I'd like to write my own code which does all of the same stuff, except checks a configuration file for 'tags' to exclude.
So my understanding is that I create my control, deriving from the base control - and I can write my own FormatTags() method - is that correct?
I only need to change one aspect of it, but does this mean I have to copy the original code for that method from the base class - and change what I need to in there? It just doesn't feel right copyign code from one spot, but I don't know of another way to extend the method without changing code in the base class.
Thanks for any suggestions.