Inheritance default access modifier in C++

I have an interface in C++ that looks something like this:

// A.h
#pragma once

class A
{
public:
    //Some declarations.    
private:    
    //Some declarations.
protected:
    //Some declarations.
};

The specific form is not important. Since this is an interface, there will be a class B that inherits from A. In the header file for class B I have:

// B.h
#pragma once

class B : A
{
public:
    //Some declarations.    
private:    
    //Some declarations.
protected:
    //Some declarations.
};

My concern is that I tend to use class B : A instead of class B : public A, just my bad memory.

So far I have had no issues with this, since it’s a small enough project. But will forgetting the public keyword affect my project in any sense?

Or more succinctly, I know how access modifiers work but, what does class B : A default to?

Source: Windows Questions C++

LEAVE A COMMENT