All Questions
7,647
questions
-3
votes
2
answers
77
views
Calling object without creating it, in CPP Oops
In the code below unfortunately I didn't create/name any object and when compiling I didn't get any error and also was able to access member function. How I need to this behaviour is this something ...
0
votes
0
answers
71
views
In C++, when is it better to use a class with a state and an "execute" method, vs just a function? [closed]
My question is about code design in general, but consider the specific context of a numerical integration tool.
Option 1: a class with a state, setters, accessors, and an execute method.
class ...
-1
votes
0
answers
79
views
What about association in c++ [duplicate]
I don't understand the concept of association in C++.
This is my code examples:
Association: Object A knows about object B. Class A depends from B but does NOT consist of it
Car
{
???
};
...
5
votes
2
answers
140
views
Assign base object without changing inherited ones?
How valid is it to assign a new object to a base one, without changing the inherited ones?
The example below works as expected, but is it by chance?
This example is simple, but is there any situation ...
-2
votes
1
answer
57
views
When calling an inherited method from a derived class it tries to use the uninitialised fields of the base class [closed]
I have two classes. One called Agent, and the other called Player. Agent is the base class and Player is the derived class.
When calling the function SetHand() from the derived Player class, I run ...
0
votes
2
answers
133
views
How do interfaces solve the circle-ellipse problem?
It is sometimes said that interfaces solve several problems of object-oriented programming, in particular the circle-ellipse problem. It would be this interface
class IEllipse {
public:
virtual ...
0
votes
0
answers
73
views
Pure virtual method called in derived class Player
I've been writing a simple 2D game in SFML. I've done a draft version of the game, but when I run the program, it reports an error:
Pure virtual method called
The debugger wrote the problem is in ...
0
votes
2
answers
54
views
class keyword for UPROPERTY()
I'm new to UnrealEngine and studying C++ development in scope of games. For now I read a tutorial where I should create a AMyPawn and UPawnMovementComponent to attach it then.
Here is the definition ...
-2
votes
2
answers
94
views
Custom integer-like datatype with support for static casts without warnings
I'm writing my own little utility library, and I've opted to do something which I don't really see often (and there might be a reason) - I'm trying to implement a 'perfect' wrapper around C++ integer ...
-7
votes
1
answer
93
views
can anyone tell me how can I create multiple objects using vector without specifying the length of vector
I tried to do it using the vector<string> and iterating through it to create the object but while assigning them value i am getting error
#include <iostream>
#include <string>
#...
-1
votes
1
answer
64
views
std::is_same_v weirdly return false when true is expected using CRT pattern
#include <iostream>
#include <type_traits>
template <template <typename,unsigned,typename...>typename interface,typename T,unsigned ChannelN, typename...Args>
struct base : ...
-2
votes
1
answer
56
views
How to share the A::a value to the other class B::b, if in A class i have class B object [duplicate]
So, I'm creating the c++ project and I've encountered a new problem.
And the question is: How i can get the A::a value in efficent way.
I will mention that class A is pretty big and i dont want to get ...
0
votes
0
answers
51
views
I was trying to create class mystack which would work like a stack datatype but i encountered unexpected output
This is the code where i tried to implement stack in c++ without pointer instead i used a interger variable called "top" to hold the current position of stack and also i created constuctor ...
1
vote
3
answers
82
views
Inheriting Structs in C++
I am working with the LibAV library, converting it from C to C++ (and moving to an object oriented style).
This library has structs to hold data, which need to be created using specific allocation ...
0
votes
0
answers
54
views
Dlls & Memory Management
This is more of a general question and not specific. I am writing a dll in C++, there are C++ classes and some extern C-wrapper functions that handle the interaction between the client and the classes....