Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public override bool Equals(object obj)
  2. {
  3. bool iguals = true;
  4. int posicio = 0;
  5. if (obj == null)
  6. {
  7. return this == null;
  8. }
  9. if (!(obj is TipusBase))
  10. {
  11. return false;
  12. }
  13. Pila<TipusBase> comparada = (Pila<TipusBase>)obj;
  14. return base.Equals(obj);
  15.  
  16. if (this.nElem != comparada.nElem)
  17. {
  18. iguals = false;
  19. }
  20. else
  21. {
  22. while (iguals && posicio < nElem)
  23. {
  24. iguals = object.Equals(dades[posicio], comparada.dades[posicio]);
  25. posicio++;
  26. }
  27. }
  28. return iguals;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement