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
Titre:
Inheritance problem
Divers
Thread ID:
00970014
Message ID:
00970014
Vues:
47
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 ?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform