Editing a parameter while creating a sub-class?

Discussion in 'C++' started by Steve555, Mar 20, 2007.

  1. Steve555

    Steve555 Guest

    Hi,

    I'm creating an object CSub, which is sub-classed from CMaster.

    The constructor for either takes a struct as an argument:

    CSub:: CSub(BasicModel *inModel : CMaster(inModel)

    and this is the struct:

    typedef struct{
    long size;
    long numVertices;
    long numTris;
    }BasicModel;


    What I want to do is edit some inModel parameters for creating a
    CSub, before passing it on to the CMaster constructor.

    Is there a way to do this?

    Thanks

    Steve
     
    Steve555, Mar 20, 2007
    #1
    1. Advertising

  2. Steve555

    Guest

    On Mar 20, 10:02 am, "Steve555" <> wrote:
    > Hi,
    >
    > I'm creating an object CSub, which is sub-classed from CMaster.
    >
    > The constructor for either takes a struct as an argument:
    >
    > CSub:: CSub(BasicModel *inModel : CMaster(inModel)
    >
    > and this is the struct:
    >
    > typedef struct{
    > long size;
    > long numVertices;
    > long numTris;
    >
    > }BasicModel;
    >
    > What I want to do is edit some inModel parameters for creating a
    > CSub, before passing it on to the CMaster constructor.
    >
    > Is there a way to do this?
    >
    > Thanks
    >
    > Steve


    This article might help you.

    http://www.ddj.com/dept/cpp/184403887
     
    , Mar 20, 2007
    #2
    1. Advertising

  3. Steve555

    Steve555 Guest

    On 20 Mar, 17:13, wrote:
    > On Mar 20, 10:02 am, "Steve555" <> wrote:
    >
    >
    >
    > > Hi,

    >
    > > I'm creating an object CSub, which is sub-classed from CMaster.

    >
    > > The constructor for either takes a struct as an argument:

    >
    > > CSub:: CSub(BasicModel *inModel : CMaster(inModel)

    >
    > > and this is the struct:

    >
    > > typedef struct{
    > > long size;
    > > long numVertices;
    > > long numTris;

    >
    > > }BasicModel;

    >
    > > What I want to do is edit some inModel parameters for creating a
    > > CSub, before passing it on to the CMaster constructor.

    >
    > > Is there a way to do this?

    >
    > > Thanks

    >
    > > Steve

    >
    > This article might help you.
    >
    > http://www.ddj.com/dept/cpp/184403887


    Yes, it did, thanks. Though after reading how they did it, it occured
    to me it I could also just create a wrapper function to create the sub-
    class, after first editing the parameter.
     
    Steve555, Mar 20, 2007
    #3
    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. THY
    Replies:
    1
    Views:
    413
    Steve C. Orr, MCSD
    Aug 19, 2003
  2. Replies:
    0
    Views:
    621
  3. Haai
    Replies:
    0
    Views:
    384
  4. Ben
    Replies:
    2
    Views:
    963
  5. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    2,177
    Lawrence D'Oliveiro
    May 20, 2011
Loading...

Share This Page