Clarify public access on gmock examples.

PiperOrigin-RevId: 436268062
Change-Id: I3161b36121f78acf920d66fe121b2f1d5e5707b9
This commit is contained in:
Abseil Team 2022-03-21 11:56:42 -07:00 committed by Copybara-Service
parent b007c54f29
commit 1754febbaa

View File

@ -8,7 +8,7 @@ Given
```cpp ```cpp
class Foo { class Foo {
... public:
virtual ~Foo(); virtual ~Foo();
virtual int GetSize() const = 0; virtual int GetSize() const = 0;
virtual string Describe(const char* name) = 0; virtual string Describe(const char* name) = 0;
@ -23,7 +23,7 @@ class Foo {
#include "gmock/gmock.h" #include "gmock/gmock.h"
class MockFoo : public Foo { class MockFoo : public Foo {
... public:
MOCK_METHOD(int, GetSize, (), (const, override)); MOCK_METHOD(int, GetSize, (), (const, override));
MOCK_METHOD(string, Describe, (const char* name), (override)); MOCK_METHOD(string, Describe, (const char* name), (override));
MOCK_METHOD(string, Describe, (int type), (override)); MOCK_METHOD(string, Describe, (int type), (override));
@ -58,7 +58,7 @@ To mock
```cpp ```cpp
template <typename Elem> template <typename Elem>
class StackInterface { class StackInterface {
... public:
virtual ~StackInterface(); virtual ~StackInterface();
virtual int GetSize() const = 0; virtual int GetSize() const = 0;
virtual void Push(const Elem& x) = 0; virtual void Push(const Elem& x) = 0;
@ -71,7 +71,7 @@ class StackInterface {
```cpp ```cpp
template <typename Elem> template <typename Elem>
class MockStack : public StackInterface<Elem> { class MockStack : public StackInterface<Elem> {
... public:
MOCK_METHOD(int, GetSize, (), (const, override)); MOCK_METHOD(int, GetSize, (), (const, override));
MOCK_METHOD(void, Push, (const Elem& x), (override)); MOCK_METHOD(void, Push, (const Elem& x), (override));
}; };