KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I come across some MC++ code like this: __gc class ClassA { Puclic: ClassB GetClassB(); } __gc class ClassB { Public: int Value; } int main() { ClassA^ a = gcnew ClassA(); ClassB^ b = a->GetClassB(); int c = b->Value; } Isn't it important to check whether b is NULL before access to its value? I tried if(b == NULL) , but it dosen't work. Or it's really not necessary to do the check? however I can hardly believe it... PS: I only want to know whether the "Reference" itself could be NULL here. Whether the content of class B is null isn't important.
Tags (comma-separated)
Save Edits
Cancel