inheritance

Ask general questions here.
jabelshauser
Posts: 55
Joined: Thu Aug 23, 2007 12:00 pm

inheritance

Post by jabelshauser » Thu Aug 30, 2007 8:50 am

What can i do with inheritance ?
Is there an example ?

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Thu Aug 30, 2007 3:19 pm

Inheritance is a technique to extend the functionality of an existing class. If you create a class that inherits from an existing Ranorex class, you can add additional functionality by overriding existing members or by creating new properties, methods, and events for the new class.

You can implement your application specific Control or Form classes with inheritance. You can find a simple sample in RanorexProVS2005Sample1:

Code: Select all

public class MyForm : Ranorex.Form
{
    /// <summary>
    /// Initializes a new instance of the MyForm class.
    /// </summary>
    /// <param name="handle"></param>
    public MyForm(IntPtr handle) : base(handle)
    {
    }

    public Button FindButtons(Int32 controlId)
    {
        Button button = base.FindButton(controlId);

        if (button != null)
        {
            Console.WriteLine("FindButton OK");
            button.Enabled = false;
            Application.Sleep(1000);
            button.Enabled = true;
            Application.Sleep(1000);
            Console.WriteLine("FindButton Sleep");
        }
        return button;
    }
}
Jenö
Ranorex Team