#include <iostream>
#include <string>
using namespace std ;
enum COLOR { Green, Blue, White, Black, Brown } ;
class Animal {
public :
    Animal() : _name("unknown") {
        cout << "constructing Animal object "<< _name << endl ;
    }
    Animal(string n,COLOR c) : _name(n),_color(c) {
        cout << "constructing Animal object "<< _name << endl ;
    }
    ~Animal() {
        cout << "destructing Animal object "<< _name << endl ;
    }
    void speak() const {
        cout << "Animal speaks "<< endl ;
    }
    void move() const { }
private :
    string _name;
    COLOR _color ;
};
class Mammal:public Animal{
public:
    Mammal(string n,COLOR c):Animal(n,c){
        cout << "constructing Mammal object "<< _name << endl ;
    }
    ~Mammal() {
        cout << "destructing Animal object "<< _name << endl ;
    }
    void eat() const {
        cout << "Mammal eat " << endl ;
    }
};
I just started transitioning from java to C++ today, am practicing some object oriented coding to know the differences.
In the above code, I am unable to access _name from mammal class.
Does the mammal class not inherit private attributes? In this case, do I have to re-create those attributes for every inheritances?
 
     
     
    