derived class member function failed in c++
<p>To make long story short:</p>

<pre><code>class A {
        public:
              A();
              ~A();
              void SetID(char* ID);
              char* GetID();
        protected:
              char ID[10];
};

class B: public A {
        public:
              B();
              ~B();
        protected:
              ...
        private:
              ...
};
</code></pre>

<p>Then in main:</p>

<pre><code> ...
 B *temp = new B;
 temp-&gt;SetID("0x12345678");
 ...
</code></pre>

<p>Then the compiler said "Expected constructor,destructor or type conversion before -> token" where "temp->SetID("0x12345678")" lies</p>

<p>Anyone gimme some hints??</p>

<p>Whole Program as Loki suggested:</p>

<pre><code>  #include &lt;iostream&gt;

  using namespace std;

  class A {
      public:
         A();
         ~A();
         void SetID(char* id);
         char* GetID();
       protected:
            char ID[10];
   };

   void A::SetID(char* id){
         strcpy(ID,id);          
    }
    char* A::GetID(){
         return ID;
    }
    class B: public A {
             public:
                 B();
                ~B();
             protected:
                int num;
     };


    int main(){
    B *temp = new B;
    B-&gt;SetID("0x12345678");
    cout&lt;&lt;B-&gt;GetID()&lt;&lt;endl;

    return 0;
    }
</code></pre>
