Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Codrea{
  5. private:
  6.     int cnp;
  7.     int nr_ci;
  8. public:
  9.     Codrea(int cnp, int nr_ci){
  10.         this->cnp = cnp;
  11.         this->nr_ci = nr_ci;
  12.     }
  13.     Codrea(){
  14.         this->cnp = 41454321;
  15.         this->nr_ci = 12;
  16.     }
  17.     int getCNP(){ return cnp; };
  18.     int getNR_CI(){ return nr_ci; };
  19. };
  20.  
  21. class Andreea : public Codrea{
  22. private:
  23.     string culoare_ochi;
  24. public:
  25.     Andreea() : Codrea(){
  26.         this->culoare_ochi = "albastru";
  27.     }
  28.     Andreea(string culoare_ochi, int cnp, int nr_ci) : Codrea(cnp, nr_ci){
  29.         this->culoare_ochi = culoare_ochi;
  30.     }
  31. };
  32.  
  33. void main(){
  34.     Andreea a("verde",104112, 15);
  35.     cout << a.getCNP() << endl;
  36.     cout << a.getNR_CI() << endl;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement