Created
October 21, 2026 11:27
-
-
Save thinkphp/3d66743ea554546990274c6d05c5c200 to your computer and use it in GitHub Desktop.
mostenire.cpp
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> | |
| #include <string> | |
| using namespace std; | |
| //clasa de baza | |
| class Animal { | |
| //modificatori de access | |
| protected: | |
| string nume; | |
| public: | |
| //constructorul | |
| // REX | |
| Animal(string nume): nume(nume) { | |
| cout<<"[Animal] constructor: "<< nume<<endl; | |
| } | |
| }; | |
| //clasa derivata | |
| class Caine: public Animal { | |
| public: | |
| // REX Animal(REX) | |
| Caine(string nume): Animal( nume ) { | |
| cout<<"[Caine] constructor"<<endl; | |
| } | |
| //destructor | |
| ~Caine() { | |
| cout<<"[Caine] destructor"<<endl; | |
| } | |
| }; | |
| class Pisica: public Animal { | |
| } ; | |
| int main(int argc, char const *argv[]) | |
| { | |
| Caine C("REX"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment