Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Publikacja : IComparable<Publikacja>
- {
- protected int id; //0 -publikacja 1-artykul 2-ksiazka
- protected string tytul;
- protected string autorzy;
- protected int rokwydania;
- public int CompareTo(Publikacja p)
- {
- if (p != null)
- {
- int i = 0;
- if (!this.Autorzy.Contains(p.Autorzy) && !p.Autorzy.Contains(this.Autorzy))
- i++;
- if (!this.Tytul.Contains(p.Tytul) && !p.Tytul.Contains(this.Tytul))
- i++;
- if (this.RokWydania != p.RokWydania && p.RokWydania != 0 && this.RokWydania!=0)
- i++;
- return i;
- }
- return -1;
- }
- }
- public class Artykuł : Publikacja
- {
- private string wydawnictwo;
- private string tagi;
- public int CompareTo(Artykuł p)
- {
- if (p != null)
- {
- int i = base.CompareTo(p);
- if (!this.Wydawnictwo.Contains(p.Wydawnictwo) && !p.Wydawnictwo.Contains(this.Wydawnictwo))
- i++;
- if (!this.Tagi.Contains(p.Tagi) && !p.Tagi.Contains(this.Tagi))
- i++;
- return i;
- }
- return -1;
- }
- }
Add Comment
Please, Sign In to add comment