Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created October 21, 2026 11:27
Show Gist options
  • Select an option

  • Save thinkphp/3d66743ea554546990274c6d05c5c200 to your computer and use it in GitHub Desktop.

Select an option

Save thinkphp/3d66743ea554546990274c6d05c5c200 to your computer and use it in GitHub Desktop.
mostenire.cpp
#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