Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Jul 1, 2016
1 parent c0408b2 commit afa2f58
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cpp-inheritance.cpp
Expand Up @@ -4,8 +4,7 @@ using namespace std;

class A {
protected:
typedef int FT;
FT x;
int x;
public:
A() : x(42) {}
};
Expand All @@ -15,7 +14,6 @@ class B : public A {

class C : public B {
protected:
typedef int FT;
typedef B Precursor;

public:
Expand All @@ -25,11 +23,11 @@ class C : public B {
cout << this->x << endl;
}

FT get() {
int get() {
return Precursor::x;
}

FT* getPtr() {
int* getPtr() {
// error: ‘A<int>::FT A<int>::x’ is protected
// error: within this context
// error: cannot convert ‘A<int>::FT A<int>::* {aka int A<int>::*}’ to ‘C<int>::FT* {aka int*}’ in return
Expand Down

0 comments on commit afa2f58

Please sign in to comment.