Another way to refer to a class is to use the "use" statement, after which the class name can be referred to without being fully qualified. In some cases, this may make the code a little more concise but still easy to understand, especially if there are multiple references to the class and its methods.
Following your example,
use Drupal\markus\Clothes\Pants; // Often placed at the top of the file.
Another way to refer to a class is to use the "use" statement, after which the class name can be referred to without being fully qualified. In some cases, this may make the code a little more concise but still easy to understand, especially if there are multiple references to the class and its methods.
Following your example,
use Drupal\markus\Clothes\Pants; // Often placed at the top of the file.
$pants = new Pants();