Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inheritance
Message
De
17/03/2010 13:31:42
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01455125
Message ID:
01455148
Vues:
63
You haven't instantiated an instance of MyDerivedClass (MyDerivedClass m_DerivedClass = new MyDerivedClass();)
>Hi,
>
>I am having a problem that I will try to present here is a simplified manner:
>
>
>public class MyBaseClass
>{
>    public DataSet myDataSet;
>    
>    public void MyMethod( string cStr )
>    {
>          // do something with the string cStr
>   }
>}
>
>public class MyDerivedClass : MyBaseClass
>{
>               // Nothing is this class, so far
> }
>
>public partial class frmMyForm : Form
>{
>   private string cStr
>   public MyDefirvedClass m_DerivedClass;
>
>   public frmMyForm()
>   {
>         InitializeComponent();
>         m_DerivedClass.MyMethod( cStr );                        //  !!! This where I get error Null Reference
>   }
>
>}
>
>
>Note that the when I type m_DerivedClass in the frmMyForm constructor the intellisense shows the methods (MyMethod among them) of the class MyBaseClass so I know that I have declared "using" correctly. Why do I get the Null Reference on call MyMethod() then?
>
>TIA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform