Why we don’t use () after the qApp class name in the Ring programming language

When we use RingQt to create GUI application using the Ring programming language, we uses () after the class name when we create new objects for example

new qWidget() { setWindowTitle(“Hello World”) resize(400,400) show() }

but before doing that we create an object from the qApp class and we don’t use () after that

Load “guilib.ring”
app = new qApp
{
    win=new qWidget()
    {
         setwindowtitle(:test)
         show()
    }
    exec()
}

 

Using () after the class name means calling the init() method in the class and passing parameters to this method

if we used () while no init() method in the class we get the expected error message

the class qApp don’t have this method while the other classes have it because they need it to create an object using a function that return a pointer to that object and this pointer will be stored in an attribute called pObject, for more information see ring_qt.ring file which contains the classes

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s