Using new/overrides etc methods? im a bit in a worry
I am designing a plugin system by my own to meet my needs.
There is the "interface" for all plugins that is like this:
Code:
public abstract class IrcPluginBase {
private IrcClient _parent;
public IrcClient Parent { get { return _parent; } set { _parent = value; } }
public void SetParent(IrcClient parent) { _parent = parent; }
public virtual void RawCommandReceived(string command) {}
public void SendRawCommand(string command) {
_parent.SocketRef.Send(command);
}
public void SendText(string nick, string channel, string txt) {
}
}
then here is a plugin's 'RawCommandReceived' function:
Code:
public void RawCommandReceived(string command) {
MessageBox.Show("hey");
}
}
My main class should then do this:
Code:
foreach (IrcPluginBase plugin in _plugins) {
plugin.RawCommandReceived(msg);
}
The problem is that this last line is calling the abstract class' 'RawCommandReceived' and not the plugin's overrided one
How should I go around this? I also tried removing the virtual/override keywords and put "new" but still the same problem :confused:
Re: Using new/overrides etc methods? im a bit in a worry
Quote:
then here is a plugin's 'RawCommandReceived' function:
Code:
public void RawCommandReceived(string command) {
MessageBox.Show("hey");
}
}