How to update typeset on classes

Discussion in 'C++' started by Josh McFarlane, May 26, 2005.

  1. I'm making a basic classes.
    (snipped for simplicity)
    class CWLRecord //Base Record Class
    {
    private:
    CWLRecord *pNextRecord ; //Pointer to next record
    } ;

    then I take this base record class and define a record for each
    different set of data I have. However, I want to make sure that when I
    create an instance of the derived class CWLRecord_Foo, instead of
    pNextRecord being a pointer of type CWLRecord, I want it class
    CWLRecord_Foo to require a pointer of type CWLRecord_Foo. However, I
    want to still be able to use functions from CWLRecord (such as WipeAll,
    RetrieveNext, etc) to be able to use pNextRecord as a generic
    CWLRecord. Can I do

    class CWLRecord_Foo : public CWLRecord
    {
    private:
    CWLRecord_Foo *pNextRecord
    };

    and have it work in the way I'd like it to? I just want to make sure
    I'm not doing something fundamentally wrong.

    Thanks,
    Josh McFarlane
     
    Josh McFarlane, May 26, 2005
    #1
    1. Advertising

  2. > However, I want to make sure that when I
    > create an instance of the derived class CWLRecord_Foo, instead of
    > pNextRecord being a pointer of type CWLRecord, I want it class
    > CWLRecord_Foo to require a pointer of type CWLRecord_Foo. However, I
    > want to still be able to use functions from CWLRecord (such as WipeAll,
    > RetrieveNext, etc) to be able to use pNextRecord as a generic
    > CWLRecord.


    Ok, that sounds confusing so let me simplify it.

    CWLRecord is a base link-list class. I want to retain next node pointer
    from the base class but when declaring an instance of a certain
    recordset (CWLRecord_Foo), I want the pointer to the next Linklist item
    to be restricted to those of type CWLRecord_Foo, but still able to use
    functions from the base.
     
    Josh McFarlane, May 26, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hartmut Schroth
    Replies:
    3
    Views:
    3,506
    Hartmut Schroth
    Dec 1, 2003
  2. joun
    Replies:
    9
    Views:
    2,241
    W.G. Ryan eMVP
    Nov 30, 2004
  3. joun
    Replies:
    5
    Views:
    2,668
  4. =?Utf-8?B?TWljaGFlbA==?=

    How to update datagrid after update

    =?Utf-8?B?TWljaGFlbA==?=, Mar 17, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    503
    Alex D.
    Mar 17, 2006
  5. Chris  Chiasson
    Replies:
    10
    Views:
    533
    Jonathan N. Little
    Dec 6, 2006
Loading...

Share This Page