Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: Find a string in a string... Living hell. Pin
ravfingcoder20-Sep-03 5:15
ravfingcoder20-Sep-03 5:15 
GeneralRe: Find a string in a string... Living hell. Pin
fadee20-Sep-03 9:54
fadee20-Sep-03 9:54 
GeneralMDI as SDI Pin
Colin Angus Mackay19-Sep-03 12:56
Colin Angus Mackay19-Sep-03 12:56 
GeneralPointers to Functions Pin
Wjousts19-Sep-03 12:36
Wjousts19-Sep-03 12:36 
GeneralRe: Pointers to Functions Pin
J. Dunlap19-Sep-03 12:48
J. Dunlap19-Sep-03 12:48 
GeneralRe: Pointers to Functions Pin
aka the guy20-Sep-03 3:47
aka the guy20-Sep-03 3:47 
GeneralRe: Pointers to Functions Pin
Wjousts20-Sep-03 13:28
Wjousts20-Sep-03 13:28 
GeneralRe: Pointers to Functions Pin
Blake Coverett20-Sep-03 15:23
Blake Coverett20-Sep-03 15:23 
Not exactly.

Yes, delegates are the correct thing to use here, but they do not magically change to reference derived methods. That is a function of how you define your methods.

Here's a small example demonstrating this fact:
using System;
class Example {
	static void Main() {
		Base b = new Derived();
		b.Test();
	}
}
class Base {
	protected delegate void D();
	protected virtual void One() {Console.WriteLine("Base.One");}
	protected void Two() {Console.WriteLine("Base.Two");}
	public void Test() {
		D[] methods = {new D(One), new D(Two)};
		foreach(D method in methods) method();
	}
}
class Derived : Base {
	protected override void One() {Console.WriteLine("Derived.One");}
	protected new void Two() {Console.WriteLine("Derived.Two");}
}

When executed it outputs:
Derived.One
Base.Two

Virtual dispatch is unrelated to delegates.

--
-Blake (com/bcdev/blake)
GeneralRe: Pointers to Functions Pin
Wjousts21-Sep-03 10:12
Wjousts21-Sep-03 10:12 
GeneralRe: Pointers to Functions Pin
Blake Coverett21-Sep-03 11:38
Blake Coverett21-Sep-03 11:38 
GeneralGetting size of Bitmap in bytes or kilobytes. Pin
TigerNinja_19-Sep-03 7:54
TigerNinja_19-Sep-03 7:54 
GeneralRe: Getting size of Bitmap in bytes or kilobytes. Pin
leppie19-Sep-03 8:29
leppie19-Sep-03 8:29 
GeneralRe: Getting size of Bitmap in bytes or kilobytes. Pin
Wjousts19-Sep-03 9:35
Wjousts19-Sep-03 9:35 
GeneralRe: Getting size of Bitmap in bytes or kilobytes. Pin
leppie19-Sep-03 10:34
leppie19-Sep-03 10:34 
GeneralRe: Getting size of Bitmap in bytes or kilobytes. Pin
Wjousts19-Sep-03 12:00
Wjousts19-Sep-03 12:00 
GeneralRe: Getting size of Bitmap in bytes or kilobytes. Pin
Blake Coverett20-Sep-03 15:25
Blake Coverett20-Sep-03 15:25 
GeneralRe: Getting size of Bitmap in bytes or kilobytes. Pin
leppie20-Sep-03 23:10
leppie20-Sep-03 23:10 
GeneralContext Menus will text box Pin
Wjousts19-Sep-03 6:56
Wjousts19-Sep-03 6:56 
GeneralRe: Context Menus will text box Pin
Carlos H. Perez19-Sep-03 10:39
Carlos H. Perez19-Sep-03 10:39 
GeneralRe: Context Menus will text box Pin
Wjousts19-Sep-03 11:59
Wjousts19-Sep-03 11:59 
GeneralRe: Context Menus will text box Pin
J. Dunlap19-Sep-03 12:16
J. Dunlap19-Sep-03 12:16 
GeneralRe: Context Menus will text box Pin
Wjousts19-Sep-03 12:29
Wjousts19-Sep-03 12:29 
GeneralRe: Context Menus will text box Pin
Nish Nishant19-Sep-03 16:23
sitebuilderNish Nishant19-Sep-03 16:23 
GeneralRe: Context Menus will text box Pin
Carlos H. Perez19-Sep-03 17:47
Carlos H. Perez19-Sep-03 17:47 
GeneralRe: Context Menus will text box Pin
Nish Nishant19-Sep-03 18:07
sitebuilderNish Nishant19-Sep-03 18:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.