Skip to content

Commit 21b1553

Browse files
committed
a general program on static keyword and exceptions of function overloading
1 parent 0b610df commit 21b1553

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

FunctionOverridingInheritence.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Anish : public Person { //public inheritence
3030
int main() {
3131

3232
Anish *a= new Anish;
33+
3334
a->intro(); //derived class method is called , not base class . Although derived class has access to base class method too, but it is overidden
3435

3536
cout<<"\n";

General Programs/StaticVar.cpp

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include<iostream>
2+
3+
using namespace std;
4+
5+
void fun(int *x) {
6+
7+
8+
9+
cout<<&x;
10+
}
11+
12+
void fun(int y[]) {
13+
14+
cout<<y<<endl;
15+
16+
}
17+
18+
int main() {
19+
20+
int x = 20;
21+
int *ptr=&x;
22+
cout<<&x<<endl;
23+
cout<<ptr<<endl;
24+
fun(&x+1);
25+
26+
27+
28+
return 0;
29+
}
30+
31+
32+

0 commit comments

Comments
 (0)