-1

There is a piece of code:

class BirdCarreau: public viscosityModel  // Private data
{


        dictionary BirdCarreauCoeffs_;
...

Why this data which is inside this PUBLIC type is said to be private data?

StoryTeller - Unslander Monica
  • 165,132
  • 21
  • 377
  • 458

3 Answers3

1

Default access protection for members in a class is private. So you need to put public: before.

The public you provided is only for the base class. But your members are extending the derived class.

Werner Henze
  • 16,404
  • 12
  • 44
  • 69
1

The class itself is public but its members are private to the user. That's the general idea of classes. you can make them public by specifically stating their access modifier to be private

Zachi Shtain
  • 826
  • 1
  • 13
  • 31
0

In your example public means that BirdCarreau inherit the data and methods from viscosityModel.So public is used to achieve public inheritance.By default, all members of a class have private access. So, the data in your class is private.

SVN
  • 254
  • 1
  • 2
  • 6