Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inheritance problem
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00970014
Message ID:
00970017
Vues:
18
Never mind !!! :(, it's friday and i've been looking at this for a bit too long. I was looking at the wrong code, the Class i was reffring to did not override the Validate method. Doh!

>Here's the situation:
>
>I have this BaseClass:
>
>public abstract class BaseDataSet : DataSet
>{
>// Constructor and other stuff here
>
>	public virtual bool Validate()
>	{
>		return true;
>	}
>
>}
>
>
>then i have this derived class:
>
>public class SomeDataset : BaseDataSet, IDataSet
>{
>// Constructor and other stuff here
>
>	public override bool Validate()
>	{
>                bool ret = this.DoSomeProcessing();
>		return ret;
>	}
>
>}
>
>
>And finally, in some other object, i have this code:
>
>public bool save( IDataSet ds )
>{
>    if (ds.Validate()}
>      { //save it }
>
>
>The problem:
>
>Only The code in the BaseDataSet class is executed for Validate() thus always return true. It should execute the derived SomeDataset.Validate()
>
>Am i missing something ?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform