Exceptions in C++

Channel:
Subscribers:
2,730
Published on ● Video Link: https://www.youtube.com/watch?v=w1tQ8BKX-30



Duration: 1:11:01
133 views
2


Exceptions are an alternative way to return from a function. Rather than returning a value, they cause the flow of control to go up each scope until it finds a try/catch block that catches the type of exception it throws, and then transfers control to that control block.

This is commonly used when we *can't* return a value from a function, like when you do vec.at() on something that doesn't exist, because any value returned would be wrong.







Tags:
csci 40
exceptions
c++