Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 24, 2004 09:43 PM by Bluemagics
Participant
1955 Points
391 Posts
Dec 24, 2004 09:50 AM|LINK
Star
9696 Points
1955 Posts
Dec 24, 2004 03:33 PM|LINK
interface IHoliday { void Wish ( string strMessage ); }; interface IChristmas : IHoliday { void Celebrate ( ); }; class HolidayAspNetUser : AspNetUser, IHoliday { public void Wish ( string strMessage ) { Response.Write(strMessage); } }; class XmasAspNetUser : HolidayAspNetUser, IChristmas { public void Celebrate ( ) { /* ... */ } }; class ScroogeAspNetUser : AspNetUser { };
foreach ( AspNetUser anuUser in AspNetUsers ) { if ( anuUser is IChristmas ) (anuUser as IChristmas).Wish("Merry Christmas and Happy New Year"); if ( anuUser is IHoliday ) (anuUser as IHoliday).Wish("Happy Holdays..."); }
Dec 24, 2004 09:43 PM|LINK
Bluemagics
Participant
1955 Points
391 Posts
Merry Xmas.net!
Dec 24, 2004 09:50 AM|LINK
pickyh3d
Star
9696 Points
1955 Posts
Re: Merry Xmas.net!
Dec 24, 2004 03:33 PM|LINK
interface IHoliday { void Wish ( string strMessage ); }; interface IChristmas : IHoliday { void Celebrate ( ); }; class HolidayAspNetUser : AspNetUser, IHoliday { public void Wish ( string strMessage ) { Response.Write(strMessage); } }; class XmasAspNetUser : HolidayAspNetUser, IChristmas { public void Celebrate ( ) { /* ... */ } }; class ScroogeAspNetUser : AspNetUser { };Now, we can do this right:foreach ( AspNetUser anuUser in AspNetUsers ) { if ( anuUser is IChristmas ) (anuUser as IChristmas).Wish("Merry Christmas and Happy New Year"); if ( anuUser is IHoliday ) (anuUser as IHoliday).Wish("Happy Holdays..."); }
Bluemagics
Participant
1955 Points
391 Posts
Re: Merry Xmas.net!
Dec 24, 2004 09:43 PM|LINK