Chapter 4. Method Overriding

In this chapter, we will cover the following recipes:

  • Overriding a Test Object method
  • Registering a method to all classes
  • Using method overriding to support object subtypes
  • Adding a new method to a class

Introduction

Method overriding is a feature of object-oriented programming languages such as C++, C#, and Java. It enables us to adopt a method or property inherited from a base class in order to address specific requirements of a class. In certain cases, overriding a method is necessary; for example, when a method in the base class is defined as abstract, or when an interface is implemented.

In UFT, the need to override a method may arise. The reasons can be diverse, from handling a customized version of a common control, to enriching the basic function, or even integrating the TO methods with an exception handling mechanism. As we will see in this chapter, it is also possible to add methods to a TO(s).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset