Home > def > virtual 
 en fr de es it nl pl pt pt_BR mk sq ca hu cs ar fa id vi ko ja ru zh zh_TW eo
Previous  Next  Edit  Rename  Undo  Search  Administration  
Documentation  
Warning! This page is not translated.  See english version 
virtual
A virtual class is a sınıf which represents a sub-component of a sınıf, but which you cannot instanciate nor reference into a değişken.

Components written in C/C++

In native components, virtual classes are a mechanism designed so that the user manipulates temporary objects, without being having to create them. It is SO much faster!

Note that the name of a virtual sınıf must begin with a dot. For example, the name of the virtual class used by the ListView.Item property is .ListViewItem.

Example

The property Item of the Qt component ListView sınıf uses a virtual class for representing a ListView item.

Virtual classes are just used as datatypes by the interpreter. But the object used behind is the real object coming from the real non-virtual sınıf.

For example, the Item property of the ListView sınıf stores the index of the item you want to deal with in the ListView object, and returns this ListView object. The ListView object becomes then a virtual class object that you cannot store in a değişken. As you must use the virtual class object immediately, by calling a method or a property on it, the stored index will be used immediately too.

Components written in Gambas

In components written in Gambas, virtual classes are classes whose name begins with an underscore.

They are actually true classes that work exactly like normal classes, and so they are not faster in any way.