Created
March 3, 2021 15:32
-
-
Save vineethm1627/cce8a894526c2bea90119bfae89b91d7 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 <iostream> | |
using namespace std; | |
class SocialWebsite { | |
private: | |
protected: | |
public: | |
virtual void secret() = 0; | |
}; | |
class Facebook: public SocialWebsite { | |
private: | |
string password; | |
void secret() { | |
cout << "password is: " << password << endl; | |
} | |
public: | |
Facebook(string password) { | |
this->password = password; | |
} | |
}; | |
int main() { | |
Facebook f("12345"); | |
SocialWebsite *sw = &f; | |
sw->secret(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment