calling a member function inside a vector

This is a discussion on calling a member function inside a vector within the C++ Programming forums, part of the General Programming Boards category; How can I call a member function of an object inside a vector? I want a function to return a ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    51

    how to call a member function inside a vector

    How can I call a member function of an object inside a vector?
    I want a function to return a value that the member function returns. Is this OK:

    Code:
    vector<dot> vDot;
    vDot.push_back(a_dot);
    
    //following code is in the function
    
    return (vDot.at(0)).gy();  //gy() means get Y and it returns an int
    Last edited by finnepower; 05-15-2004 at 01:47 PM.
    I abuse:

    Borland C++ Builder 6 Enterprise Edition

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Conceptually, yes.

    Kuphryn

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    51
    Quote Originally Posted by kuphryn
    Conceptually, yes.

    Kuphryn
    I know, the error was somewhere else in the code, but the compiler pointed to that line.
    I abuse:

    Borland C++ Builder 6 Enterprise Edition

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

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