Danpe
Danpe

Reputation: 19047

Access properties of base class?

I have this class:

public class CameraWindow : PictureBox

Can i somehow access the Image property from inside of the class?

And can i access the Events? like onload?

Upvotes: 0

Views: 25348

Answers (3)

Eoin Carroll
Eoin Carroll

Reputation: 178

Are you dealing with Windows Forms or similar? In that case the event is probably Load, and you can tie it up with something like Load += new EventHandler(Form1_Load);

The prompts will help you generate an event handler.

Upvotes: 0

abatishchev
abatishchev

Reputation: 100248

public class CameraWindow : PictureBox
{
    void Test()
    {
        this.Image; // or just Image
    }
}

public class CameraWindow : PictureBox
{
    public override object Image
    {
        { get { return base.Image; } }// note base
    }
}

Upvotes: 6

Lucero
Lucero

Reputation: 60190

Sure, just use them... all public and protected members are directly accessible.

Upvotes: 6

Related Questions