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.
-
@jsulm means commerce->getPlatForm() will particular class pointer object which can call its member member function like platform->requestPaymentAsync(txnContext);
am i right ?
@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.
-
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 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? MaybecommerceResultis not the actual result yet, it's a "handle" which can be used later to get the result when it's available. LikeQFutureand "Promises"...? -
@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? MaybecommerceResultis not the actual result yet, it's a "handle" which can be used later to get the result when it's available. LikeQFutureand "Promises"...?@JonB i want to understand meaning of this line? What happens first ?
-
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. -
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.@SGaist Thanks for explaining.
can any body tell me which c++ concept will help me to understand this types of statement ?
-
@SGaist Thanks for explaining.
can any body tell me which c++ concept will help me to understand this types of statement ?
@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 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);@jsulm means commerce->getPlatForm() will particular class pointer object which can call its member member function like platform->requestPaymentAsync(txnContext);
am i right ?
-
@jsulm means commerce->getPlatForm() will particular class pointer object which can call its member member function like platform->requestPaymentAsync(txnContext);
am i right ?
@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.
-
@jsulm means commerce->getPlatForm() will particular class pointer object which can call its member member function like platform->requestPaymentAsync(txnContext);
am i right ?
@Qt-embedded-developer
Not sure what your issue/lack of understanding is here.In C++ any expression like
a->b.c->d().e()->for 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.