HowToForums.net Forum Index HowToForums.net
An Open Source of Knowledge
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The Equal override method ...

 
Post new topic   Reply to topic    HowToForums.net Forum Index -> OpenU Technical Discussion
View previous topic :: View next topic  
Author Message
sharonshmuelfeldman



Joined: 29 Jul 2009
Posts: 8

PostPosted: Tue Aug 04, 2009 6:32 pm    Post subject: The Equal override method ... Reply with quote

basically it's the same cascading stuff we went throught beofore :

/* for Vp */
/////////////////////////////////////////////////////////
public override bool Equals(object obj)
{

// If parameter is null return false.
if (obj == null)
{
return false;
}

// If parameter cannot be cast to Point return false.
Vp p = obj as Vp;
if ((System.Object)p == null)
{
return false;
}
if ((options == p.options) && base.Equals(obj))
{
return true;
}
else
{
return false;
}
}
// for Manager
///////////////////////////////////////////////
public override bool Equals(object obj)
{

// If parameter is null return false.
if (obj == null)
{
return false;
}

// If parameter cannot be cast to Point return false.
Manager p = obj as Manager;
if ((System.Object)p == null)
{
return false;
}
if (base.Equals(obj) && (car == p.car))
{
return true;
}
else
{
return false;
}
}

/////////////////////////////////////////////////////////////////////////////////
/* for student */

public override bool Equals(object obj)
{

// If parameter is null return false.
if (obj == null)
{
return false;
}

// If parameter cannot be cast to Point return false.
Manager p = obj as Manager;
if ((System.Object)p == null)
{
return false;
}
if (base.Equals(obj) && (id == p.id))
{
return true;
}
else
{
return false;
}
}
//////////////////////////////////////////////////////////////////////
/* for Employee */

public override bool Equals(object obj)
{

// If parameter is null return false.
if (obj == null)
{
return false;
}

// If parameter cannot be cast to Point return false.
Employee p = obj as Employee ;
if ((System.Object)p == null)
{
return false;
}
if (base.Equals(obj) && (id == p.id))
{
return true;
}
else
{
return false;
}


//////////////////////////////////////////////////////////////////////
/* for Person */
public override bool Equals(object obj)
{
// If parameter is null return false.
if (obj == null)
{
return false;
}

// If parameter cannot be cast to Point return false.
Person p = obj as Person;
if ((System.Object)p == null)
{
return false;
}
if (Id == p.Id)
{
return true;
}
else
{
return false;
}
/////////////////////////////////////////////////////////////////////////
________
Chrysler f platform history
Back to top
Display posts from previous:   
Post new topic   Reply to topic    HowToForums.net Forum Index -> OpenU Technical Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group