I have some curly question..
I can define alias for the class at top of my document, Such as
using MyName = Bla.Bla.ClassName
But can I define something like this in the method?
In Java, Alias is used when reference, which is of more than one, is linked to the same object. The issue with aliasing is when a user writes to a particular object, and the owner for the several other references do not expect that object to change.
An alias is a reference to another object, the same as a synonym.
Updated on March 07, 2019. To alias a method or variable name in Ruby is to create a second name for the method or variable. Aliasing can be used either to provide more expressive options to the programmer using the class or to help override methods and change the behavior of the class or object.
The aliases() method is a built-in method of the java.
No, you can't. If you mean that you want to define a class alias inside a method, this is not possible.
Alias could be defined only at file or namespace level:
using MyName = Bla.Bla.ClassName;
namespace A{
...
}
or
namespace A{
using MyName = Bla.Bla.ClassName
...
}
If you instead mean you want to define a "method alias", this also isn't possible: alias are only for types or namespaces.
No, using
directives have to either be outside any declaration, or within a namespace declaration:
using Foo;
namespace Bar
{
using Baz;
}
You can't do this within a method. Why not just do it for the whole class though? Why do you only want it to apply within a particular method?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With