73.2k views
1 vote
For a class Foo, one difference between a variable declared Foo * and a variable declared Foo & is that only the variable declared Foo & can potentially have the value NULL.

Select one:

a. FALSE

b. TRUE

User Bialy
by
4.7k points

1 Answer

0 votes

Answer:

False.

Step-by-step explanation:

When we declare a variable as reference type we have to initialize that variable otherwise the compiler will give error that the reference variable is not initialized.You also cannot initialize the variable Foo& with NULL value because it is a reference variable and we have to initialize it.

On the other there is no need to initialize the variable Foo * since it is a pointer it can also store NULL value.

So the answer is only Foo* can store NULL value not Foo &.

User Rat
by
4.1k points