can any body explain what is meaning of below statment
-
commerceResult = commerce->getPlatForm()->requestPaymentAsync(txnContext);
i want to understand what happen sequence wise function call. which function get first executed.
i have not used this types of function call any where. i want to know concept about it.
-
@Qt-embedded-developer commerce->getPlatForm() returns a pointer to an object. Then requestPaymentAsync(txnContext) is called on this object (via the returned pointer). Nothing special, really.
-
@Qt-embedded-developer said in can any body explain what is meaning of below statment:
i want to understand what happen sequence wise function call. which function get first executed.
What do you mean by this?
commerce->getPlatForm()
gets executed right now. And functionrequestPaymentAsync()
gets executed right now too.The
requestPaymentAsync()
, guessing by its name, starts some asynchronous (thread?) operation? MaybecommerceResult
is not the actual result yet, it's a "handle" which can be used later to get the result when it's available. LikeQFuture
and "Promises"...? -
Hi,
It's executed left to right.
getPlatform() returns a pointer to some object.
requestPaymentAsync is immediately called on said object.
The result of that method is stored in commerceResult. -
@Qt-embedded-developer said in can any body explain what is meaning of below statment:
can any body tell me which c++ concept will help me to understand this types of statement ?
Method calling on a pointer to object...
SomeClass *obj = new SomeClass(); obj->someMethod();
The line you were asking can also be written as:
auto platform = commerce->getPlatForm(); commerceResult = platform->requestPaymentAsync(txnContext);
-
@Qt-embedded-developer commerce->getPlatForm() returns a pointer to an object. Then requestPaymentAsync(txnContext) is called on this object (via the returned pointer). Nothing special, really.
-
@Qt-embedded-developer
Not sure what your issue/lack of understanding is here.In C++ any expression like
a->b.c->d().e()->f
or similar is simply evaluated left-to-right, one element at a time. How else but that could it be done? So that's all you have to think of.