Skip to content

Instantly share code, notes, and snippets.

@vineethm1627
Created March 3, 2021 15:32
Show Gist options
  • Save vineethm1627/cce8a894526c2bea90119bfae89b91d7 to your computer and use it in GitHub Desktop.
Save vineethm1627/cce8a894526c2bea90119bfae89b91d7 to your computer and use it in GitHub Desktop.
#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