SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Mar 2002
    Location
    Pune, MH, India
    Posts
    41
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    call a method of derived class from method of base class.

    Hi,

    I want to call a method of derived class from method of base class.
    Is this possible in SilkTest 5.5 ?

    winclass DriverClass
    {
    Initialize()
    {
    EnterValue();
    }

    }

    winclass LoginClass
    {
    EnterValue(string sValue)
    {
    print("Entervalue called from derived class.")
    }
    }

    main ()
    {
    LoginObject login = LoginClass()
    // should invoke method on Loginclass.
    login.Initialize()
    }

    Regards.

    -Niteen


    ------------------

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: call a method of derived class from method of base class.

    This is possible; you will need to declare the method in the base class also (in order for it to compile at all), and you will need to make it a virtual method. See 'Defining "virtual" methods' in the manual under 'Method declaration'.

    ------------------

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: call a method of derived class from method of base class.

    Correct, if you want to call a method(#1) in the base class that in turn calls a method(#2) that is defined in the derived class you will use the keyword "virtual" infront of the method in the base class.

    Check out the example under the keyword "derived" in the help.

    You would not need to use "virual" if you were to call a method directly from the sub class.

    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:34 AM.

Copyright BetaSoft Inc.