Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Concept of Init Function of class
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

I m creating a class named TestReportFile, in which i want to create Excel file. I want that on creation of object of TestReportFile class, Excel test report file should be created.
Like this:

Set obj = new TestReportFile ' This should create Excel file in required directory. And in Init() of TestReportFile class, i wrote code for creation of Excel report file. Because i assume that on creation of object Init() is called of that class. But this did not happen.

Please tell me how Init() will be called? and on creation of object of a class, does Init() is called or not? What is the usage of Init() in classes? What is the concept of constructor of a class in QTP?

Thanks
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
create an object of your class. say - Set oClass = New TestReportFile
Now you can initialise this with
oClass.Init()

In QTP you will need to cal the init function. it will not get aumatically at the time of creting object.

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  DP Encapsulation Within Class Object TheGlovner 2 1,774 10-12-2018, 02:11 PM
Last Post: TheGlovner
  Dynamic obj rep - get text in the class (html) marcio cravo moreira 0 2,123 05-26-2015, 06:58 PM
Last Post: marcio cravo moreira
  Calling a Function in Function Library when function is defined in an Action jitenderkkr 0 2,963 11-27-2014, 12:53 PM
Last Post: jitenderkkr
  can class be a variable in DP wyrdo 1 2,464 08-07-2013, 01:33 PM
Last Post: anil2u
Sad QTP Script | how to get object of some open window just using its class type,Java sophia.sabir 1 8,862 08-07-2013, 01:26 PM
Last Post: anil2u

Forum Jump:


Users browsing this thread: 1 Guest(s)