Data hiding means keeping some data inside a class private so that no one outside the class can change or see it directly. In C++, we use the keyword 'private:' to hide variables. To work with these hidden variables, we create public methods like setLength and getLength. When we try to access a private variable directly, the program gives an error. But using public methods, we can safely change or read the data. This protects the data from accidental or wrong changes. The example shows a class Box with a private variable length. We create an object b of Box. Trying to access b.length directly fails. But calling b.setLength(10) sets the value, and b.getLength() returns 10. This is how data hiding works to keep data safe inside classes.