WideStudio Logo
WideStudio
Programming Guide
WideStudio Index
Table of contents


How to access to the method of the specified class

In the chapter: [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 header file of the class.

Document Release 3.20 for WideStudio ver 3.20, Oct 2002


WideStudio documents index | Table of contents

Copyright(C) T. Hirabayashi, 2000-2002 Last modified: Oct 27, 2002