Linked Questions

0 votes
1 answer
10k views

I am working on a project for class that is a sort of payroll. Part of the prompt says "You may define a friend function that overloads << for displaying the Employee object information(i.e. ...
Lunch's user avatar
  • 57
-1 votes
1 answer
55 views

I am a beginner in C++.I am trying to overload my cout operator for my template. However, it does not accept the way that i used for my classes' operators.So, i am here to learn your thoughts. This ...
Mert Özçelik's user avatar
2493 votes
10 answers
1.1m views

Note: The answers were given in a specific order, and have received varying amounts of votes over time. Since the order of answers depends on your answer sorting preferences, here's an index of the ...
sbi's user avatar
  • 225k
1071 votes
27 answers
508k views

The meaning of both eludes me.
Maciek's user avatar
  • 20.1k
262 votes
7 answers
491k views

I am confused on how to separate implementation and declarations code of a simple class into a new header and cpp file. For example, how would I separate the code for the following class? class A2DD {...
drdrdr's user avatar
  • 2,978
2 votes
2 answers
6k views

I want to overload the operator << to print a list using std::cout, for example: std::cout << list //ouputs as {1,2,3,..} After searching, I came to know that this can be done using ...
Aiman Khan's user avatar
5 votes
4 answers
212 views

All my classes implement a dump member function, e.g.: struct A { template <typename charT> std::basic_ostream<charT> & dump(std::basic_ostream<charT> &o) const {...
AlwaysLearning's user avatar
4 votes
3 answers
195 views

I had a midterm in c++ and one of our assignments was to write a class, that overloads the << operator so that we could print private fields of that class to std::ostream, like so: Crate c1(...
19greg96's user avatar
  • 2,591
3 votes
1 answer
2k views

This is my very first question on StackOverflow. I've searched for similar "Identifier not Found" errors but couldn't find anything helpful. I'll be grateful for your help since I've been trying to ...
Muratcan Akcay's user avatar
2 votes
3 answers
528 views

hey, i got something that i cannot understand ,there are two types of solutions for overloading this operator 1 is including the friend at the start of the method and the other 1 goes without the ...
Nadav's user avatar
  • 2,775
0 votes
2 answers
324 views

I'm learning C++ and specifically the operator overloading. I have the following piece of code: #include <iostream> #include <string> using namespace std; class Vector2 { private: ...
piquesel's user avatar
  • 159
2 votes
1 answer
98 views

I want to make a behavior like std::cout has: int a = 10, b = 15, c = 7; MyBaseClass << "a = " << a << ", b = " << b << std::endl; I try to implement some things which I'...
JavaRunner's user avatar
  • 2,565
0 votes
1 answer
75 views

First of all it's an exercise given to me so i can't change things and have to work with it. I have a 2d vector aka a matrix. My header file looks like this #include <vector> #include <...
wonkas42's user avatar