Last active
December 28, 2016 18:51
-
-
Save saisumit/20ea35bbfb25684ed18e7fc0c1e50bd6 to your computer and use it in GitHub Desktop.
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<bits/stdc++.h> | |
| /* When Panda is Life ! | |
| _,add8ba, | |
| ,d888888888b, | |
| d8888888888888b _,ad8ba,_ | |
| d888888888888888) ,d888888888b, | |
| I8888888888888888 _________ ,8888888888888b | |
| __________`Y88888888888888P"""""""""""baaa,__ ,888888888888888, | |
| ,adP"""""""""""9888888888P""^ ^""Y8888888888888888I | |
| ,a8"^ ,d888P"888P^ ^"Y8888888888P' | |
| ,a8^ ,d8888' ^Y8888888P' | |
| a88' ,d8888P' I88P"^ | |
| ,d88' d88888P' "b, | |
| ,d88' d888888' `b, | |
| ,d88' d888888I `b, | |
| d88I ,8888888' ___ `b, | |
| ,888' d8888888 ,d88888b, ____ `b, | |
| d888 ,8888888I d88888888b, ,d8888b, `b | |
| ,8888 I8888888I d8888888888I ,88888888b 8, | |
| I8888 88888888b d88888888888' 8888888888b 8I | |
| d8886 888888888 Y888888888P' Y8888888888, ,8b | |
| 88888b I88888888b `Y8888888^ `Y888888888I d88, | |
| Y88888b `888888888b, `""""^ `Y8888888P' d888I | |
| `888888b 88888888888b, `Y8888P^ d88888 | |
| Y888888b ,8888888888888ba,_ _______ `""^ ,d888888 | |
| I8888888b, ,888888888888888888ba,_ d88888888b ,ad8888888I | |
| `888888888b, I8888888888888888888888b, ^"Y888P"^ ____.,ad88888888888I | |
| 88888888888b,`888888888888888888888888b, "" ad888888888888888888888' | |
| 8888888888888698888888888888888888888888b_,ad88ba,_,d88888888888888888888888 | |
| 88888888888888888888888888888888888888888b,`"""^ d8888888888888888888888888I | |
| 8888888888888888888888888888888888888888888baaad888888888888888888888888888' | |
| Y8888888888888888888888888888888888888888888888888888888888888888888888888P | |
| I888888888888888888888888888888888888888888888P^ ^Y8888888888888888888888' | |
| `Y88888888888888888P88888888888888888888888888' ^88888888888888888888I | |
| `Y8888888888888888 `8888888888888888888888888 8888888888888888888P' | |
| `Y888888888888888 `888888888888888888888888, ,888888888888888888P' | |
| `Y88888888888888b `88888888888888888888888I I888888888888888888' | |
| "Y8888888888888b `8888888888888888888888I I88888888888888888' | |
| "Y88888888888P `888888888888888888888b d8888888888888888' | |
| ^""""""""^ `Y88888888888888888888, 888888888888888P' | |
| "8888888888888888888b, Y888888888888P^ | |
| `Y888888888888888888b `Y8888888P"^ | |
| "Y8888888888888888P `""""^ | |
| `"YY88888888888P' | |
| ^""""""""' | |
| */ | |
| using namespace std; | |
| const int SZ=10; | |
| class String | |
| { | |
| protected: | |
| char str[SZ]; | |
| public: | |
| String() | |
| { | |
| str[0] = '\0'; | |
| } | |
| String(char s[]) | |
| { | |
| cout << "\nEntered String\n"; | |
| strcpy(str,s); | |
| } | |
| void display() const | |
| { | |
| cout << str << endl; | |
| } | |
| operator char*() // type casting | |
| { | |
| return str; | |
| } | |
| }; | |
| class PString : public String | |
| { | |
| public: | |
| PString(char s[]):String(s) | |
| { | |
| int j; | |
| int l = strlen(s); | |
| cout<<l<<endl; | |
| if(l>SZ-1) | |
| { | |
| for(j=0;j<SZ-1;j++) | |
| { | |
| str[j] = s[j]; | |
| } | |
| str[j]='\0'; | |
| } | |
| else | |
| { | |
| //String* obj = new String(s); | |
| } | |
| } | |
| }; | |
| int main() | |
| { | |
| PString s1 = "small"; | |
| s1.display(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment