How to Overige memebr of base class after inhertince

This is a discussion on How to Overige memebr of base class after inhertince within the C++ Programming forums, part of the General Programming Boards category; Hello all i have this : Code: class A { public : A(int i ) : m_S(i) { m_Pa = ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    58

    How to Overige memebr of base class after inhertince

    Hello all
    i have this :
    Code:
    class A {
        public :
            A(int i ) : m_S(i)
            {  
                m_Pa = new Foo(*this) ;
            }
        private :
            int m_S ;
    }
    
    and derived class 
    
    class B : public A {
        public :
            B() : A (242) 
            {
              // here i like to Overige  the A class m_Pa memeber but i dont know how to do it right 
            }
    }

  2. #2
    C++11 User Tux0r's Avatar
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    135
    Quote Originally Posted by umen242 View Post
    Hello all
    i have this :
    Code:
    class A {
        public :
            A(int i ) : m_S(i)
            {  
                m_Pa = new Foo(*this) ;
            }
        private :
            int m_S ;
    }
    
    and derived class 
    
    class B : public A {
        public :
            B() : A (242) 
            {
              // here i like to Overige  the A class m_Pa memeber but i dont know how to do it right 
            }
    }
    I don't see any m_Pa declared.

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    58
    sorry

    ...
    ...
    private :
    int m_S ;
    Foo* m_Pa;

  4. #4
    C++11 User Tux0r's Avatar
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    135
    And what do you mean by "Overige"? If you mean override you can do just as you did with m_S

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Virtual base class
    By George2 in forum C++ Programming
    Replies: 7
    Last Post: 03-14-2008, 07:45 AM
  2. derived class can not access base class protected member?
    By George2 in forum C++ Programming
    Replies: 2
    Last Post: 10-21-2007, 06:32 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. dynamic array of base class pointers
    By Corrington_j in forum C++ Programming
    Replies: 1
    Last Post: 11-16-2003, 04:58 AM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21