Thank you, I got it working. As for the using declarations being in source, so in my .h files i just have #include <vector> #include <whatever> and std::vector and std::whatever, and then in the cpp...
Type: Posts; User: CH1156
Thank you, I got it working. As for the using declarations being in source, so in my .h files i just have #include <vector> #include <whatever> and std::vector and std::whatever, and then in the cpp...
So I added a new class to my project and then when i went to compile I got almost 300 errors, I managed to get it down to 3, but I cant seem to figure out what the issue is, it doesn't seem apparent...
Yeah I realized that mistake and removed the for loop from my first post and that works fine, but with this I want to remove every element where the tuple has a value of 0 for the second element of...
If the player has 3 weak potions and they use alll of them, how would I remove the tuple element of that item? I cant seem to get it working.
for (auto& i : mInventory)
{
...
Ohhhhhhh, thank you so much, I've been having trouble figuring that out.
But how does that look in code? thats where im confused. I cant seem to figure out how to get the index of the vector and the tuple, if it was a normal vector i could just do something like:
...
So in my game the player can use items from their inventory, which is a vector of tuple (
vector<tuple<Item, int>> mInventory{ 0 };) and in my code I noticed an issue, If the player has a Weak...
bump I've been told this is bad design? not really sure why though, they didnt specify, to me this was perfectly reasonable solution.
I am working on a console game and I am wondering if this is correct usage and setup of class objects, mainly in main, I think it's ok but idk, it just doesnt feel right, it feels like a kludge to...
YES, that is exactly what I wanted to do thank you, I struggled with that for so long! I didnt know there was a name for it. I'll do more research on composition to understand it better and see more...
bump?
I could make a Vendor class, since a Vendor has both a shop and items, I could inherit these things from that, but what if I had a class that was unrelated to another but needed to compare values to...
So how would I make this work? I mean some parts of the classes have to interact, I need to be able to check if the player has enough credits to buy an item, so I need to compare players credits to...
Awesome thank you! I'll play around with this and try to improve on it.
I have some classes and i'm trying to use an Item object in the Shop, I need to setup the items that can be sold but VS keeps giving me errors.
#include "pch.h"#include <iostream>
#include...
I am making a program that "simulates" genetic breakdown in DNA and simulates population growth of a fake group of beings, what I need to do is simulate beings pairing up with male and female and ...
Awesome! thank you.
Sure, but I wanted to test out the constructor inheritance, which is mainly why I made the child classes, I agree they're useless otherwise.
Well, I havent finished writing them yet, I wanted to make sure the constructor copying wasnt doing anything weird before I moved on, they'll all have their own purpose soon enough, this program is...
Ok so here is my updated code with a solution I found after hours of searching:
#include <iostream>
class Character
{
public:
While I was writing some code I noticed something:
In this program
#include <iostream>
So i've been playing with the code for a while now and doing some researcha nd I found this method works, but it seems tedious to do and fix, is there a simpler way?
#include <iostream>
class...
On top of that, I wanted to add the Discharge weapon and reload weapon fucntions to Weapon but how do I use them if I cant create an object of it in main?
#include <iostream>
class Weapon
{...
Oh I had another question about classes in general, its the constructor. The newer versions of C++ allow you to initialize variables right in the class without the constructor:
class Weapon{
...
Awesome thank you!