Thread: Do constructors get inherited?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Shadow12345
    Guest

    Do constructors get inherited?

    I mean do they? It doesn't seem that they do, that's just silly

    Code:
    class Human : public Parent {
    public:
    	Human(string name);
    
    
    private:
    
    
    };
    
    Human::Human(string name) {
    	Name = name;
    }
    Human is a derived class of Parent. parent is technically a human as well.

    I get this error:
    [error]
    Compiling...
    human.cpp
    C:\human.cpp(162) : error C2512: 'Parent' : no appropriate default constructor available
    Error executing cl.exe.

    human.exe - 1 error(s), 0 warning(s)
    [/error]

    that is really silly, I mean more silly than silly can possibly be!
    Last edited by Shadow12345; 08-21-2002 at 09:47 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help With Inherited Classes Needed
    By elliott in forum C++ Programming
    Replies: 4
    Last Post: 12-11-2005, 09:05 AM
  2. constructors, arrays, and new
    By Thantos in forum C++ Programming
    Replies: 6
    Last Post: 05-30-2004, 06:21 PM
  3. Inherited constructors with parameters
    By dave74 in forum C++ Programming
    Replies: 3
    Last Post: 11-20-2003, 11:27 AM
  4. Replies: 4
    Last Post: 12-29-2002, 12:29 AM
  5. Copy constructors and private constructors
    By Eibro in forum C++ Programming
    Replies: 5
    Last Post: 11-24-2002, 10:16 AM