What syntax is the following (C++/WinRT)

Vijayadithyan .N 121 Reputation points



Universal Windows Platform (UWP)
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
2,895 questions
{count} votes

Accepted answer
  1. WayneAKing 4,266 Reputation points

    How can you put a function inside a function like that

    It's not entirely clear what you are asking.

    If you're wondering how the two functions are declared so that
    they can be invoked in a compact statement (concatenated), the
    answer is that there is nothing special that needs to be done.

    Using the dot operator allows using am implicit temporary
    object so that you don't have to declare an explicit object.

    For example:

    class MyClass {
        string s;
        string SetString(string str)
            s = str;
            return s;
    MyClass c1;
    // using explicit variables:
    string temp = c1.SetString("12345");
    int n = temp.size();
    cout << n << endl;
    // using implicit variables:
    cout << c1.SetString("XYZ").size() << endl;

    SetString returns a string and that string can be an
    anonymous implicit object, the members of which can
    be accessed using the dot operator.

    • Wayne
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful