Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,5 +1,9 @@
|
|||
int *p = nullptr;
|
||||
...
|
||||
if(p == nullptr){
|
||||
if (p == nullptr){
|
||||
// do some thing
|
||||
}
|
||||
//or just
|
||||
if (p){
|
||||
// do some thing
|
||||
}
|
||||
|
|
|
|||
22
Task/Null-object/Eiffel/null-object.e
Normal file
22
Task/Null-object/Eiffel/null-object.e
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
class
|
||||
APPLICATION
|
||||
inherit
|
||||
ARGUMENTS
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
local
|
||||
i: INTEGER
|
||||
s: detachable STRING
|
||||
do
|
||||
if i = Void then
|
||||
print("i = Void")
|
||||
end
|
||||
if s = Void then
|
||||
print("s = Void")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1 +1,7 @@
|
|||
puts "object is null" if object.nil?
|
||||
puts "@object is nil" if @object.nil? # instance variable
|
||||
|
||||
puts "$object is nil" if $object.nil? # global variable, too
|
||||
|
||||
# It recognizes as the local variable even if it isn't executed.
|
||||
object = 1 if false
|
||||
puts "object is nil" if object.nil?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue