Question: I am building a website in which one needs to login to get access to his /her profile
So, some of the pages are the same for the user and the admin(i.e.both of them are able to view the pages using the respective login-id)and the code I used for ensuring that no person can enter into the url and have access WITHOUT LOGGING was

```
     if (Session["cod"] == null && Session["admin"] == null)
    {
        Response.Redirect("You need to Login.aspx");
    }

```

in the page load event
This is working absolutely fine

but the problem rises in case of those pages which are reserved for the admin;HERE THIS CODE DOES NOT WORK
here after logging even a simple user can have access by writing into the url an admin page path
Thanx in advance

Answer: 
In `C.cpp`, you're defining `A::setVisibility`, not `C::setVisibility`.
You can change your class C to:

```
// C.h
class C : public B
{
     public:
        C();
        virtual ~C();
        using A::setVisibility;
        virtual bool setVisibility();
};

```

This will "reintroduce" all kinds of setVisibility defined in A.