Hi, i have a question, so suppose you have a function and it had a return value that was a reference like int& foo(), why would you return an int instead of a int& like the return value says we're...
Type: Posts; User: cuo741
Hi, i have a question, so suppose you have a function and it had a return value that was a reference like int& foo(), why would you return an int instead of a int& like the return value says we're...
I still kinda dont get it, i sort of get it but, i'm still confused on the return value and stuff. Can you explain why is that the return value is String& and we return an object(*this) and in the...
But, we don't return a alias to the object, we just return the object itself dont we though? I'm sorry for the trouble, thank you for the help
What i meant was like, if i return an object will the return value come out as a reference to that object but you're arent actually returning the actual object?
And also, in this other snippet of...
I haven't learned how to throw exceptions yet, the book covers that in later chapters so this would be the appropriate code for my level of programming but, later on i'll make sure to fix that.
I...
Hi, i'm confused about these lines of code:
(this is in the POV of me talking to the creator of a book thats why im saying you guys(as in the writers of the book))
String& operator=(const...
Hello, so I've been working on a little project of mine, i'm trying to imitate a black jack game without the fancy rules though, just the basics. Here's the code:
#include <iostream>
#include...
C++ is my first language btw, i'm on classes right now.
How much will knowing how to competently code in C++ look on my college app. I heard it looks good but, how good does it look? By that i mean like will it give a little leeway on grades or SAT...
I was wondering is there a way to get better at programming?? like i know i've heard the usual response, "Practice makes perfect so just keep programming". Like sometimes when im programming i'm...
I don't really know what you guys are saying because I'm only on classes right now. Any tips on getting better at Object Oriented Programming?
Okay thanks
Like I'm trying to write a method of class Human thats named getItem. It is suppose to check if the 0th element of the vector is empty or not written yet and store the string(Name of item) in there...
Is there any way I'm able to do this then?
I was wondering if there was a way to check if theres already stored in a vector element.
For example:
vector<string> Inventory;
I searched up vector methods and I saw the empty() method...
I was wondering if you guys could think up a exercise using classes and ill try to make a program for it?? it doesnt have to be fancy and stuff
Really??I searched it up on Amazon and the reviews are pretty good but, i dont know
But dont you need to have a pointer in the parameters of DrinkWater so it can point at an object and modify the member variables of that instance?
i've finished my waterbottle program:
#include <iostream>
using namespace std;
class Waterbottle
{
public:
string Brand;
when i do this:
Waterbottle *ptrBottle;
ptrBottle = new Waterbottle;
am i making a instance named ptrBottle of class Waterbottle??
and if so, when i call a function would i have write...
Yay! it worked ;D thanks a lot for your help, i kinda get classes a little bit better now.
#include <iostream>
using namespace std;
class Waterbottle
{
public:
string Brand;
float height;
int WaterLevelPercent;
#include <iostream>
using namespace std;
class Waterbottle
{
public:
string Brand;
float height;
int WaterLevelPercent;
well, if you remember my objects in functions thread, its not that i dont know it, i would say im familiar with it but, i cant think of any programs to implement the skills i have learned.
I've done some of C and i went up to 2D arrays before i went on to learn C++