Nubling question

This is a discussion on Nubling question within the C++ Programming forums, part of the General Programming Boards category; I have a 3rd party header that has a function declaration in it like this - Code: static int Foo(FooClass& ...

  1. #1
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189

    Nubling question

    I have a 3rd party header that has a function declaration in it like this -

    Code:
    static int Foo(FooClass& FooData);


    I can't seem to recall what exactly they are wanting passed, it looks like they want the data in FooClass passed, but that doesnt make sense int eh context its used in.

    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,168
    O_o

    Using my amazing powers of Fu, the function expects you to snarfle the garfax.

    Soma

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    FooClass is being passed as a non-const reference, meaning either the interface isn't const-correct or they expect to modify FooData. That would tell me that FooData is an output parameter and you don't necessarily need to pass anything specific in, you just need to provide an object for the function to modify.

  4. #4
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    well the problem is I cant figure out how to create FooData in such a way that I can pass it and then access the contents after the call returns. I tried

    Code:
    FooClass* FooData = new FooClass();
    it refuses to accept a FooClass* as a FooClass&

    so how do I create this
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Uh ...
    Code:
    FooClass FooData;
    Foo(FooData);
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,801
    Here
    Code:
    FooClass fooData;
    Foo(fooData);
    Woop?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

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