Guest User

Untitled

a guest
Aug 20th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Osoby
  7. {
  8.     public class Osoba
  9.     {
  10.         private string nazwisko;
  11.         private int rok;//rok urodzenia
  12.  
  13.         public void SetName(string tmpnazwisko)//ustawia nazwisko
  14.         {
  15.             this.nazwisko = tmpnazwisko;
  16.         }
  17.  
  18.         public string GetName()//zwraca nazwisko
  19.         {
  20.             return this.nazwisko;
  21.         }
  22.  
  23.         public void SetDate(int tmprok)//ustawia rok urodzenia
  24.         {
  25.             this.rok = tmprok;
  26.         }
  27.  
  28.         public int GetDate()//zwraca rok urodzenia
  29.         {
  30.             return this.rok;
  31.         }
  32.  
  33.         public override Boolean operator <(Osoba a, Osoba b)//a<b return true,a>=b return false
  34.         {
  35.             Boolean tmp;
  36.             if(string.Compare(a.nazwisko, b.nazwisko,true)<0)
  37.                 tmp=true;
  38.             else
  39.                 tmp=false;
  40.  
  41.             return tmp;
  42.         }
  43.  
  44.  
  45.  
  46.     }  
  47. }
Add Comment
Please, Sign In to add comment