Class - public

Can somebody explain me what does "public mesh" in the code I attach mean? I understand that if the class is called FVM, the constructor must be named FVM, so I don't understand the meaning of this "public mesh" before the "{" that starts defining the class.

class FVM: public mesh
{
public:
//!Constructor
FVM();
FVM(const mesh &_mesh, unsigned int nFields = 1);

//!Destructor
~FVM();

/*!Return the total number of fields contained*/
unsigned int nFields();
[...]

Last edited on
That is the syntax to define inheritance.
http://www.cplusplus.com/doc/tutorial/inheritance/#inheritance
As Zhuge has said, it's just inheritance. The class FVM is inheriting from the class mesh. Personally, I've never had a use to inherit with anything but public. I really don't see why C++ even has access specifiers on inheritance like this. Here's a good explanation on how it works: http://stackoverflow.com/questions/5447498/what-are-access-specifiers-should-i-inherit-with-private-protected-or-public
Thanks Zhuge and residentBiscuit
Topic archived. No new replies allowed.