Last active
January 24, 2020 13:04
-
-
Save sahilbansal17/a7c1209d8e2b7c2ce3ede5030b281994 to your computer and use it in GitHub Desktop.
Predict the output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class A{ | |
public: | |
virtual void functionA() { | |
cout << "function A of class A called!" << endl; | |
} | |
virtual void functionB() { | |
cout << "function B of class A called!" << endl; | |
} | |
void functionC() { | |
functionA(); | |
functionB(); | |
} | |
}; | |
class B: public A{ | |
public: | |
void functionA() { | |
cout << "function A of class B called!" << endl; | |
} | |
void functionB() { | |
cout << "function B of class B called" << endl; | |
} | |
}; | |
int main() { | |
A helloA; | |
B helloB; | |
helloB.functionC(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int a = 4; | |
int func(int a, int b = 13) { | |
int c = a++ + ++::a*3 -++b; | |
return c; | |
} | |
int main() { | |
int a1 = 5; | |
cout << func(a1); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment