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: 
The other answers are all correct before the correction. But it's not the solution to the problem. There actually isn't any problem at all. The problem lies in my implementation of the `setVisibility`-method, that's where the segfault occurs. Therefore the solution can't be found here.

Thanks to all who tried to help!
regards
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.