Passing back objects from with functions. Datatype?
I am declaring an object from within a function, and am trying to pass the object back into main.
When looking up what datatype to use to hold the object,(where you could use 'void' in a function declaration), all I find are the fundamental datatypes such as int and bool.
Hear is the part of the function:
cout << "Before creating an object of type car" << endl;
cars temp; //construct an object called 'temp' of type 'cars'
cout << "Enter the MPG" << endl;
cin >> temp.MPG;
cout << "After creating an object of type car" << endl;
I want to return the object 'temp' of class 'cars' back to main, but I'm finding the fundamental datatypes don't work.
Thanks for any help!