Write a C++ program to print the string in reverse order using the Multiple inheritances in object-oriented programming.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#include<iostream> #include<conio.h> using namespace std; class T4tutorials { protected: string str; }; class T4tutorials2 { protected: int i; }; class a : public T4tutorials, public T4tutorials2 { public: int call() { string str="i Love T4Tutorials"; for(int i=str.length()-1; i>=0; i--) cout<<str[i]; } }; int main() { a obj; obj.call(); } |
Output
I Love T4Tutorials.
slairotut4t evoL I.