Thread: Classe constructor and Vector question

  1. #16
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Also that pointer to a reference or what it is in the constructor looks spooky but I dont know if that is valid or not.
    Depends on how it's interpreted... if it's a pointer-reference, it's valid and I use it all the time. On the other hand, if it's a reference-pointer, that *might* be problematic. Either way, you should use ( ) to make it clear which one it is.

    (Object*)& obj

    I don't know how you'd make it clear what you're doing if you want to do it the other way though, i.e.

    Object &(*obj)
    or
    Object *(&obj)

    Both are kind of iffy... like, a pointer to an Object&? or is it a reference to an Object *obj? Who knows, only the person that wrote the compiler or maybe Prelude ( )
    Last edited by Hunter2; 03-28-2004 at 12:43 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #17
    Registered User
    Join Date
    Apr 2002
    Posts
    81
    Thanks for the input, it is much appreciated but I've tried it that way, and I still get errors.

    Quote Originally Posted by Shakti
    I suggest you read up on functions and some basic programming stuff before you move on with classes.
    I couldn't agree with you more, that's what I would like to do, but I have to do this program just the same with these specs on top of 4 other classes which are non programming related. I really wished I could only concentrate on C++ and nothing else, but unfortunately, I can't. I think it's crazy the way they show us how to program blindly, without much explanation or without any time to really learn the depth of the language.

    Quote Originally Posted by Shakti
    Also that pointer to a reference or what it is in the constructor looks spooky but I dont know if that is valid or not.
    Well, I'm not sure that I'm going to need a pointer, but what I'm trying to do here is pass the wordrecord (that includes the vector and the linerecord) into a binary search tree so that when I search for a word (that can be found in the vector of the word record) it will return that word and the whole line record. I think I have my find word function working right, but I wont know until I can insert everything properly.

    Needless to say, I am quite confused, and I've been working on this for countless hours. It is due tomorrow morning, but I need to study for a physics exam so I guess it may be a little late

    In any case, I will keep at it because I want and need to know how to do this, so I will surely come back with revised code and questions when I can finally get back to it.
    "Our greatest glory consists not in never failing,
    but in rising every time we fall."

    Oliver Goldsmith (1730-1774).
    Anglo-Irish writer, poet and playwright.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I reach Protected Variables?
    By zayzay in forum C++ Programming
    Replies: 8
    Last Post: 07-14-2005, 06:32 AM