In c++ we can calls method of a class without instantiating it. Such as;
MyClass mc; mc.method();
what are the advantages & disadvantages of using methods of class without instantiating it? When should we use this type?
Just because you haven't explicitly invoked a constructor, doesn't mean you haven't instantiated it. The form you've used invokes the default constructor. This may or may not setup the class correctly, but that's a matter for the class's author to sort out, not the code that uses it.
EDIT: It occurs to me that the advice I gave might confuse more than it helps, so I'll provide a couple of examples:
The following class has a trivial default constructor that doesn't initialise its members:
You can use this class with or without an explicit constructor:
In both forms above, the class is instantiated and the instance is ready for use without causing any crashes or invoking undefined behaviour. In the case of
...or passing the object to another function to populate...
In other cases, the default constructor must initialise the object in a non-trivial way:
The purpose of the constructor is to convert raw memory into a usable object. In the case of
The key message in all of this is that the object may or may not be initialised, but it is instantiated.
You're confusing instantiating with whether you create it on the stack (in your example) or on the heap (with new).
Object lifetime (and memory management) aside, there's no real difference in calling the methods on one vs. the other. It's more about object size and how long you need it to be around.