Assuming that we have:
class A ...
class B inherit A ...
f (a_a: A) ...
Then, can you write something like the following pseudocode, without using a temporary variable?
-- `y` is an argument to B's constructor.
f (create B.make(y))
Assuming that we have:
class A ...
class B inherit A ...
f (a_a: A) ...
Then, can you write something like the following pseudocode, without using a temporary variable?
-- `y` is an argument to B's constructor.
f (create B.make(y))
Copyright © 2021 Jogjafile Inc.
You are looking for a creation expression. Unlike creation instruction, it omits target entity, but always specifies a creation type:
Note. As a rule of thumb, if a type can be confused with an entity, it is enclosed in curly braces. For example, in the phrase
create B.make (y)the terminalBis interpreted as an entity name. Enclosing it in the braces promotes it to a type.