Relative Content

Tag Archive for c++oop

Adding a help menue in terminal c++

i,m just working on a game project that it’s a board game in c++ .
the players have their own cards to play and if they want play a card they need to enter card’s name or they can pass their turn and at the same time they can enter “help” or “help <card’s name>” and i have a problem here how to program second command i mean if player enter help all information will be shown but when he/she enter help with a card’s name only the part that it’s related to the given card will be shown

Setting the type of a member variable in a base class based on a non-direct descendant?

I’m facing the following conundrum in C++ for which I can’t seem to find a solution. I have an abstract class Model at the top of my inheritance hierarchy which I need to contain a member variable representing the model parameters. It implements a whole bunch of boilerplate logic and is used for polymorphism. The type of this variable depends on the most derived classes implementing concrete models, e.g. HullWhite needs to inherit a HullWhiteParams member from Model.

Overhead of operator loading in larrge C++ Matrix

I’m trying to implement a Matrix class in one-dimensional arrays managing dynamic memory with contiguos double type elements, (just for learning purposes), and I’m thinking in large non-squared matrices. Does the use of a temporary object to overload operators causes a important overhead as it implies creating and destroing many pointers? Or it is and early attemp of optimazation? Also, What algernatives do I have?

How to implement object-oriented in C language?

I want to use C language to implement object-oriented, which should support inheritance, polymorphism, public or private data and methods. To do this, I thought of the following methods:

What can I do better in developing C++ code based on my recent checkers console project?

I have been learning to code in C++ since September of last year and this is my most advanced project so far. It’s the game of checkers played in the console. It was written using the Clion IDE. What would my code be more professional and readable? What would make it more efficient? I was also thinking of learning to do graphics with C++ so I could take this project further.