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

Vijayadithyan .N 121 Reputation points
2022-04-30T12:37:10.633+00:00

197849-image.png

197908-screenshot-2022-04-30-180528.png

Universal Windows Platform (UWP)
C++
C++
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.
3,783 questions
{count} votes

Accepted answer
  1. WayneAKing 4,921 Reputation points
    2022-05-02T04:28:59.907+00:00

    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;
    public: 
        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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.