Hi, I was wondering if this idea I have is correct, I couldn't find an answer online

if i had a simple class
Code:
      class Dog
     { 
            Dog(x,y);
            public:

            void   coolFunction(Dog) ;//Receives object of type Dog as parameter

            private: 
              int x;
              
              int y ;

          }
So since the coolFunction(Dog Object) takes an object of type Dog, instead of declaring a
new object Dog dog1
and do this
Code:
          coolFunction(dog1); ...//first method
I should be able to do this
Code:
           coolFunction(Dog(4,4)) ; //second method
I believe that that the second method will create a temporary object in memory by calling the Vector(x,y) constructor,.. and when that copy is passed to the coolFunction(...) the object is then destroyed.


Can someone tell me if that is wrong or right?
Or if that is a good practice or idea..i know in C# the same concept is used or it is acceptable.