Skip to content

Commit 0427a7b

Browse files
committed
.
1 parent 466d82a commit 0427a7b

4 files changed

+54
-2
lines changed

Advanced-Cpp-Programming.vcxproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@
128128
</Link>
129129
</ItemDefinitionGroup>
130130
<ItemGroup>
131-
<ClCompile Include="Exception-Basics.cpp" />
131+
<ClInclude Include="resource.h" />
132+
</ItemGroup>
133+
<ItemGroup>
134+
<ClCompile Include="Standard-Exceptions.cpp" />
132135
</ItemGroup>
133136
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
134137
<ImportGroup Label="ExtensionTargets">

Advanced-Cpp-Programming.vcxproj.filters

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@
1515
</Filter>
1616
</ItemGroup>
1717
<ItemGroup>
18-
<ClCompile Include="Exception-Basics.cpp">
18+
<ClCompile Include="Standard-Exceptions.cpp">
1919
<Filter>Source Files</Filter>
2020
</ClCompile>
21+
<ClCompile Include="Standard-Exceptions.cpp">
22+
<Filter>Source Files</Filter>
23+
</ClCompile>
24+
</ItemGroup>
25+
<ItemGroup>
26+
<ClInclude Include="resource.h">
27+
<Filter>Header Files</Filter>
28+
</ClInclude>
2129
</ItemGroup>
2230
</Project>

Standard-Exceptions.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Learn Advance C++ Programming
2+
// Standard Exceptions
3+
4+
#include <iostream>
5+
using namespace std;
6+
7+
class CanGoWrong {
8+
public:
9+
CanGoWrong() {
10+
char* pMemory = new char[99999999999999];
11+
delete[] pMemory;
12+
}
13+
};
14+
15+
16+
int main() {
17+
18+
19+
try {
20+
CanGoWrong wrong;
21+
}
22+
catch (bad_alloc &e) {
23+
cout << "Caught Exception " << e.what() << endl;
24+
}
25+
26+
return 0;
27+
}

resource.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//{{NO_DEPENDENCIES}}
2+
// Microsoft Visual C++ generated include file.
3+
// Used by Advanced-Cpp-Programming.rc
4+
5+
// Next default values for new objects
6+
//
7+
#ifdef APSTUDIO_INVOKED
8+
#ifndef APSTUDIO_READONLY_SYMBOLS
9+
#define _APS_NEXT_RESOURCE_VALUE 101
10+
#define _APS_NEXT_COMMAND_VALUE 40001
11+
#define _APS_NEXT_CONTROL_VALUE 1001
12+
#define _APS_NEXT_SYMED_VALUE 101
13+
#endif
14+
#endif

0 commit comments

Comments
 (0)