Dim s As String = “abcde”
Dim mb As MemoryBlock
mb = s
’ mb.Size = 5 (1 byte for each character)
The above code works and stores a memory block for the created string.
As you can see we can create an object “mb” without the “New” keyword and this works
However when i tried to insert a class in my project , I had to instantiate objects with the New keyword unlike MemoryBlock Class otherwise it threw NilObjectException error*
Oh i thought that the string say “boy” gets converted to ASCII representation and then it would be stored in the memory areas which we can define as to how many bytes using MemoryBlock(3) where 3 means store memory for 3 bytes of data.
Why is such a word masculine in English and feminine in Spanish?
The important thing here is the description of MemoryBlock in the documentation.
Picture (also) worked without New (a long time ago), then one day the syntax changed and now you have to (not always) use New. The documentation shows how to do this.
First masculine in English and feminine in Spanish are different , one means male and another means female.
The question here asked was if we can Skip New in creation of MemoryBlock
Then when we try to instantiate our own Class objects we cannot skip New there , we must always have to use New.
Just with some predefined Classes like MemoryBlock and Picture as you mentioned we can Skip New…
This is invoking MemoryBlock.Operator_Convert(String). Operator_Convert is a special method name that overloads the conversion operator (=) and instantiates the object without calling its Constructor method.