Inheritance

This is a discussion on Inheritance within the C++ Programming forums, part of the General Programming Boards category; I am creating a program that is using a base class account and two derived classes sav_acct and chk_acct. I ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    38

    Inheritance

    I am creating a program that is using a base class account and two derived classes sav_acct and chk_acct. I also have a derived class using sav_acct as a base called time_acct.
    The problem I am having is an error when I try to compile stating 'type name expected' directed toward this statement in my main program: p=new chk_acct( arguments for account).
    I have declared p as follows: account *p;.
    If anybody could give me some help, it would be greatly appreciated.
    SilasP

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    You sure that the chk_acct base is made before that assignment?
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    38

    chk_acct base

    All of the classes are seperate header files.
    Such as account.h, sav_acct.h, chk_acct.h, and time_acct.h.
    The account class is the parent class and the others are derived classes of account. I have included the header file in the main program if that was what you were asking. I'm not sure if the ifndef statements are completely correct or are working right. Any suggestions?
    SilasP

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 06-08-2009, 03:03 PM
  2. Virtual inheritance
    By 6tr6tr in forum C++ Programming
    Replies: 13
    Last Post: 05-07-2008, 11:20 AM
  3. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 08:04 AM
  4. inheritance and performance
    By kuhnmi in forum C++ Programming
    Replies: 5
    Last Post: 08-04-2004, 12:46 PM
  5. Inheritance vs Composition
    By Panopticon in forum C++ Programming
    Replies: 11
    Last Post: 01-20-2003, 03:41 AM

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