[class.access.virt]

# 11 Classes [[class]](./#class)

## 11.8 Member access control [[class.access]](class.access#virt)

### 11.8.6 Access to virtual functions [class.access.virt]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/classes.tex#L5246)

The access rules ([[class.access]](class.access "11.8 Member access control")) for a virtual function are determined by its declaration
and are not affected by the rules for a function that later overrides it[.](#1.sentence-1)

[*Example [1](#example-1)*: class B {public:virtual int f();};

class D : public B {private:int f();};

void f() { D d;
 B* pb = &d;
 D* pd = &d;

 pb->f(); // OK, B​::​f() is public, D​::​f() is invoked pd->f(); // error: D​::​f() is private} â *end example*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/classes.tex#L5272)

Access is checked at the call point using the type of the expression used
to denote the object for which the member function is called
(B* in the example above)[.](#2.sentence-1)

The access of the member function in the class in which it was defined
(D in the example above) is in general not known[.](#2.sentence-2)
