Most viewed questions in C++

0 votes
0 answers

Do you use Qt and why do you use it?

Cons and advantages? How long does it ...READ MORE

Jul 13, 2022 in C++ by Nicholas
• 7,760 points
213 views
0 votes
0 answers

What are the new features in C++17?

C++17 is currently feature complete, therefore major ...READ MORE

Jul 26, 2022 in C++ by Nicholas
• 7,760 points
211 views
0 votes
0 answers

Difference between set.upper_bound() and upper_bound(set.begin(), set.end()) stl

I discovered that set.upper bound() was quicker ...READ MORE

Jun 29, 2022 in C++ by Damon
• 4,960 points
211 views
0 votes
1 answer

Constructor Overloading in C++

In your function Object() { [native code] }, Node(Game(),v); does not work as expected.  It simply creates a temporary without actually using it, and has no effect.  When control passes over the ;, it immediately destroys the temporary. Initializing the members in each function Object() { [native code] } is the correct way to go.  You could put their shared code in a private init() member function and call it from each function Object() { [native code] }, as shown below: class Foo { public: ...READ MORE

Jun 21, 2022 in C++ by Damon
• 4,960 points
211 views
0 votes
0 answers

What is a stream in C++?

I've been hearing a lot about streams, ...READ MORE

Aug 11, 2022 in C++ by Nicholas
• 7,760 points
210 views
0 votes
0 answers

How to end C++ code

I want my C++ code to terminate  ...READ MORE

Aug 17, 2022 in C++ by Nicholas
• 7,760 points
201 views
0 votes
0 answers

C++ Singleton design pattern

I recently came upon a C++ realization/implementation of the Singleton design pattern.  It looked like this (I took it from a real-life example): // a lot of methods are omitted ...READ MORE

Jul 4, 2022 in C++ by Nicholas
• 7,760 points
200 views
0 votes
0 answers

Purpose of Unions in C and C++

I had previously utilised unions with ease; however, I was startled when I read this post and discovered that this code union ARGB { uint32_t colour; ...READ MORE

Jul 13, 2022 in C++ by Nicholas
• 7,760 points
199 views
0 votes
0 answers

Container Class vs Class - C++

I'm new to programming and have only ...READ MORE

Jul 28, 2022 in C++ by Nicholas
• 7,760 points
198 views
0 votes
0 answers

What does '&' do in a C++ declaration?

As a C person, I'm attempting to comprehend some C++ code.  The declaration of my function is as follows: int foo(const string &myname) { cout ...READ MORE

Aug 17, 2022 in C++ by Nicholas
• 7,760 points
197 views
0 votes
0 answers

throwing a run time error

I just started Programming: Principles and Practice Using C++ because I'm new to programming.  Errors and how to handle them are covered in one of the chapters. What I'm attempting to implement is this little line of code.  The programme will end with a system error message and the text we gave as a parameter, according to the book's description of error(). #include <iostream> #include <string> using namespace std; int area (int ...READ MORE

Jul 13, 2022 in C++ by Nicholas
• 7,760 points
197 views
0 votes
0 answers

Visual C++ vs Visual C# , which is the best to learn?

I completed my C++ lessons and practises ...READ MORE

Jul 22, 2022 in C++ by Nicholas
• 7,760 points
192 views
0 votes
0 answers

what is containership or nesting in C++?

According to what I believed, a class ...READ MORE

Jul 11, 2022 in C++ by Nicholas
• 7,760 points
191 views
0 votes
0 answers

How does "this" cascading work?

The following class interface I have is: ...READ MORE

Aug 16, 2022 in C++ by Nicholas
• 7,760 points
189 views
0 votes
0 answers

How member functions are implemented in C++?

I read somewhere that member functions in C++ are similar to regular functions but with an additional implicit this parameter. As a result, I assumed that this software would be unable to discriminate between two functions.  However, the software executed successfully.  So, was the above statement incorrect? #include <iostream> class MyCls { ...READ MORE

Jul 22, 2022 in C++ by Nicholas
• 7,760 points
183 views
0 votes
0 answers

How to use c++ swap function?

It is OK to write swap(a,b); There is an issue when I write swap(&c[0],&d[0]);.  Can anyone explain why? #include<iostream> #include<algorithm> using namespace std; int main(void){ ...READ MORE

Jul 1, 2022 in C++ by Nicholas
• 7,760 points
180 views
0 votes
0 answers

Confused with object arrays in C++

I have some Java knowledge and now ...READ MORE

Aug 11, 2022 in C++ by krishna
• 2,820 points
178 views
0 votes
0 answers

What does the C++ standard state the size of int, long type to be?

I'm seeking for specific information on the sizes of basic C++ types.  I understand that it is determined by the architecture (16 bits, 32 bits, or 64 bits) and the compiler. But are there any C++ standards? On a 32-bit architecture, I'm using Visual Studio 2008.  This is what I get: char : 1 byte short : 2 ...READ MORE

Jul 7, 2022 in C++ by Nicholas
• 7,760 points
178 views
0 votes
0 answers

Difference between 'new operator' and 'operator new'?

What is difference between "new operator" and ...READ MORE

Jun 15, 2022 in C++ by Nicholas
• 7,760 points
177 views
0 votes
0 answers

Purpose of Unions in C and C++

I had previously used unions with ease, but when I read this post and learned that this code union ARGB { uint32_t colour; ...READ MORE

Jul 13, 2022 in C++ by Nicholas
• 7,760 points
172 views
0 votes
0 answers

Why are exceptions so rarely used in C++

I've been writing in C++ on and ...READ MORE

Jun 29, 2022 in C++ by Damon
• 4,960 points
166 views