question about classes

This is a discussion on question about classes within the C++ Programming forums, part of the General Programming Boards category; just to make sure... i can return a class from a function correct??? ie. if i had a class: car, ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    12

    question about classes

    just to make sure... i can return a class from a function correct??? ie. if i had a class: car, i could have a function manipulate a certain car and return it.:



    class car
    {
    blah();
    whatever();
    };

    car function();

    void main(void)
    {
    car Ford;

    Ford = function();
    }


    car function();
    {
    car buick;
    codeTo();
    defineBuick();
    return Buick;
    }


    should work right...

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    yea...

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    12
    thx..... must just be a problem elsewhere in my program

  4. #4
    Registered User biosx's Avatar
    Join Date
    Aug 2001
    Posts
    230
    Not to be a jerk , but you don't return a class but you return an object. I'm sorry, it's like midnight here and I need something to do.

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    12
    i apoligize for my inexperience with the terminology. Thank you for correcting me.

  6. #6
    Registered User biosx's Avatar
    Join Date
    Aug 2001
    Posts
    230
    Originally posted by Kespire
    i apoligize for my inexperience with the terminology. Thank you for correcting me.
    I've been there, man. We all have.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Classes question...
    By Raigne in forum C++ Programming
    Replies: 24
    Last Post: 09-12-2006, 02:46 AM
  2. Replies: 2
    Last Post: 07-28-2006, 03:59 PM
  3. Simple Question about Classes
    By Loctan in forum C++ Programming
    Replies: 5
    Last Post: 06-26-2006, 03:40 AM
  4. Classes and Win32 API, and another Question
    By philvaira in forum Windows Programming
    Replies: 10
    Last Post: 04-10-2004, 08:21 PM
  5. Newbie question about the Private type in classes
    By Ryeguy457 in forum C++ Programming
    Replies: 1
    Last Post: 09-07-2002, 11:17 PM

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