inheritance of module variables

Experiences, small talk, and other automation gossip.
bimal jose
Posts: 4
Joined: Thu Mar 14, 2013 6:36 am

inheritance of module variables

Post by bimal jose » Tue Mar 11, 2014 10:35 am

Hi
is it possible to inherit module variable over different code modules. For example i have module variable (say mVar) in a standard code module (stdModule). is it possible to avail the module variable (mVar) in a different code module ?
way to add module variable -- right click and select the option "Insert Module Variable".

TIA

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: inheritance of module variables

Post by Support Team » Fri Mar 14, 2014 3:31 pm

Hello bimal jose,

Yes of course, you can just derive the class which holds the module variable in order to access the module variable.

I have created a small sample:

Expect we have a module variable “NewVariable” within our class UserCodeModule1.

Code: Select all

string _NewVariable = "";
    	[TestVariable("41A00519-B0A9-4E40-9D4F-2C81774655FB")]
    	public string NewVariable
    	{
    		get { return _NewVariable; }
    		set { _NewVariable = value; }
    	}
In our class UserCodeModule2 we derive from UserCodeModule1 like shown below:

Code: Select all

public class UserCodeModule2 : UserCodeModule1, ItestModule
Now you are able to access our module variable „NewVariable within our UserCodeModule2-class.
ModuleVariable.png
Regards,
Robert
You do not have the required permissions to view the files attached to this post.