Skip to content

Commit

Permalink
Merge pull request #9 from jahnabiroy/main
Browse files Browse the repository at this point in the history
operator overloading
  • Loading branch information
Uniquedex100 authored Jun 8, 2024
2 parents 00ddd31 + 845d0a0 commit ee8ca71
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions problem-of-the-day/day12/dev.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# Dev Problem Of the Day (08/06/2024)
# Dev Problem Of the Day#12

## Introduction to Web Sockets
## Operator Overloading

- ### What are Web Sockets?
- ### What is Operator Overloading?

`Web sockets` are defined as a two-way communication between the servers and the clients, which mean both the parties, communicate and exchange data at the same time.
`Operator overloading` is a feature in C++ that allows you to redefine the behavior of standard C++ operators when they are used with user-defined classes or structures.

- ### How are web sockets different from HTTPS?
- ### Points to keep in mind

`Web Sockets` are different because they work by holding the connection from the client to the server open at all times. This way, the server can send information to the client, even in the absence of an explicit request from the client. The WebSocket connection allows for constant communication in the case of new data being created and therefore needing to be rendered client-side. This is how _Gmail_ emails pop up on your feed instantly, without you have to refresh. We call this **_full-duplex_** communication between the server and the client.
- Overloading an operator does not change its precedence or associativity.
- Not all operators can be overloaded in C++. New operators cannot be created.
- The overloaded operator must have at least one operand that is of a user-defined type.
- **Overloading the `<<` operator :**
- This [Link](https://learn.microsoft.com/en-us/cpp/standard-library/overloading-the-output-operator-for-your-own-classes?view=msvc-170) explains with example how `cout` can be overloaded for your own classes.
- **Overloading for comparing objects :**
- This [Link](https://www.learncpp.com/cpp-tutorial/overloading-the-comparison-operators/) gives the implementation to `compare two objects`.

- ### Resources

- This [link](https://blog.teamtreehouse.com/an-introduction-to-websockets?source=post_page-----10b131182559--------------------------------) gives a brief introduction to everything you need to know about Web Sockets.
- This [documentation](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) will help in implementing web sockets.
- This [link](https://learn.microsoft.com/en-us/cpp/cpp/operator-overloading?view=msvc-170) contains everything you need to know about operator overloading and its implementation.
- This [documentation](https://en.cppreference.com/w/cpp/language/operators) can also be referred for implementation.

#### Do implement and experiment in C++ to get a better understanding of the concept!

0 comments on commit ee8ca71

Please sign in to comment.