Sure, but CWallet isn’t outside, as it inherits from public Chain::Notifications, an “is a” relationship?
private
also forbids derived classes from access. This should be explained in any resource that explains C++ access modifiers.
You can also see with a simple diff that this can’t be private:
0wallet/wallet.cpp:2998:41: error: 'hasAssumedValidChain' is a private member of 'interfaces::Chain'
1 if (chain.havePruned() || chain.hasAssumedValidChain()) {
2 ^
3./interfaces/chain.h:97:18: note: implicitly declared private here
4 virtual bool hasAssumedValidChain() = 0;
0diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
1index c2babaaa46..11bca0706a 100644
2--- a/src/interfaces/chain.h
3+++ b/src/interfaces/chain.h
4@@ -95,2 +95,4 @@ class Chain
5 {
6+ //! Return true if an assumed-valid chain is in use.
7+ virtual bool hasAssumedValidChain() = 0;
8 public:
9@@ -285,5 +287,2 @@ public:
10 virtual void requestMempoolTransactions(Notifications& notifications) = 0;
11-
12- //! Return true if an assumed-valid chain is in use.
13- virtual bool hasAssumedValidChain() = 0;
14 };