John Weisz
John Weisz

Reputation: 31934

What is the relation called if ClassB::Method(); is in ClassA

If I have the classes:

class ClassA
{
    private $data;

    public function GetData()
    {
        ClassB::ConvertData($this->data);
    }
}

class ClassB
{
    public static function ConvertData($data)
    {
        // Do something with data
        return $data;
    }
}

... then what is the relation between ClassA and ClassB called? The way I see it is not a composition, since ClassA has no object instance of ClassB, but still uses one of its methods. I'm leaning towards believing this is a dependency, but ClassA receives no instance of ClassB - neither through a constructor nor a method.

Some additional, but related questions:

  1. Is there a difference if ClassB is abstract?
  2. Is there a difference if there is no data passed/returned between those two classes?

Thanks for reading, I'd greatly appreciate your help. Just for some clarification, I attempted multiple searches for this, but I'm not sure on how I might search for this on the www.

Upvotes: 1

Views: 45

Answers (1)

xmojmr
xmojmr

Reputation: 8145

...Call is a usage dependency that specifies that the source operation invokes the target operation...

Call is denoted with the standard stereotype «call» whose source is an operation and whose target is also an operation.

This relationship may also be applied to the class containing an operation, with the meaning that there exists an operation in the class to which the dependency applies...

Source: uml-diagrams.org: Dependency in UML

Upvotes: 1

Related Questions