Wide Studio Programmer's Guide

Wide Studio Home
Up to


How to access to the method of the specified class

In the capter: [To cast the WSCbase* into the specified class], you can cast WSCbase* to the pointer of the specified class. Following example shows accessing of the method of WSClist class. WSClist class displays the list of some strings, and the WSClist::addString() method adds the specified string to the list.
  #include "WSClist.h" //use WSClist class.
  ...
  void some_function(...){
    //get the instance: name=list001, class=WSClist.
    WSCbase* object;
    object = (WSCbase*)WSGIappObjectList()->getInstance("WSClist","list001");

    //cast to WSClist pointer, and execute WSClist::addItem().
    WSClist* list = (WSClist*)object->cast("WSClist");
    list->addItem("sample string",0)

In the example, it gets the instance which name is "list001" and which class is WSClist from the instance management. The instance management returns WSCbase*, it casts WSCbase* to WSClist*,and executes the WSClist::addItem() method. In the top of the source, we must include the headder file of the class.
Document Release 1.3

For Use with Wide Studio Release 1.3, Summer 2001


Wide Stuido Home | Up to

Copyright(C) T. Hirabayashi, 2000-2001 Last modified: August 20, 2001