I am new to StackOverflow and C++. I started to make a bank program but ran into a problem where the AddMoney() function does not work in Tranfer() function of class BankAccount. I tried running it in main() and there it works. I also tried to just directly add to the balance variable and this ..
Category : oop
which is the best way to input the parameters? and then to display them together with "sum". The condition was to use virtual functions / abstract classes. #include <iostream> using namespace std; class progression { protected: double a0; double r; virtual void sum(int) = 0; }; class ARITHprogression: public progression { double g_suma(int n) { ..
Lets say there are two classes: Map and Entity. Map has an array of pointers to all Entities in the game, and the player uses a map to check if there is an empty spot where he is going to go. So, in the main function, I am doing the following: map->getEntity(x, y)->walk(map) which causes ..
In my application I have two classes a course class and a category class. The course class has a vector containing categories. using namespace std; class Course { private: string courseName; double courseGrade, totalCategoryWeight; vector<Category> categories; public: //These are the two funcs in my Course class not working as expected void addCategory(); vector<Category> getCategoriesVector(); }; ..
I want to pass this as a default value to a function. Like: template<typename T> void fn(int a, T* = this) { …. } But I want this to be from the class that’s calling it, not the class it’s defined in. Alternatively, if there’s a way to automatically pass this in that can also ..
I want to pass this as a default value to a function. Like: template<typename T> void fn(int a, T* = this) { …. } But I want this to be from the class that’s calling it, not the class it’s defined in. Alternatively, if there’s a way to automatically pass this in that can also ..
I am trying to return all the contests that have a value bigger than 30 for catfish but in my case it returns only the first one. I have this in my main.cpp bool second_search(const string &name, string &id) { Angler elem; AnglerEnor t(name); bool l = false; for(t.first(); !l && !t.end(); t.next()){ l = ..
Here is what I’m trying to do. class Parent{ private: int a; }; class Child:public parent{ private: int b; }; class outsideWorld{ private: vector<Parent> myvec; //note vector of type parent class. public: void myfunc(){ Child obj; obj.b = 30; myvec.push_back(obj); } void display(){ //help needed here //trying to display elements of child class from myvec ..
After learning some c++ stuff, I started to do some simple projects. In one of my function I have a problem, but I can’t figure out what that is. It should modify book records in a text file… and I think I have written everything correct, it should work… And after 3 hours of trying ..

I build this struct and it does not compile, someone have any idea what I have to change here? add a picture of bugs typedef struct RequestResult { std::vector<unsigned char> response; IRequestHandler* newHandler; } RequestResult; Source: Windows Que..
Recent Comments