TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Marco
NA
59
0
overloadingg operator
Oct 27 2007 2:05 PM
Hello, I have this problem:
class Person {
string name;
string surname;
public static bool operator ==(Person p1, Person p2)
{
if (p1.name == p2.name && p1.surname == p2.surname) return true;else return false;
}
}
//main program..
Person p = p.Mysearch("Tim"); // if it don't found Tim, Mysearch() return null
if (p == null) { ......} //problem is here
The problem is when I check for p ==null; I have defined == the check p.name and p.surname but null HASN'T any attribute (it isn't a person...
How can I solve it problem??
thanks.
Reply
Answers (
3
)
Solve an expression stored in a string
C# application without .NET