Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication40
- {
- class ember
- {
- public string nev1; //személy neve
- public string nev2; //házastárs
- protected int ev1; // sz.kor
- protected int ev2; //h.kor
- protected string nem1; //sz.nem
- protected string nem2; //h.nem
- public string apa;
- public string anya;
- public List<string> t = new List<string>();
- public List<string> gy = new List<string>();
- //
- public void setev1(int a)
- {
- if (a > 1913 && a < 1995) ev1 = a;
- else throw new Exception ("Hibás évszám.");
- }
- public void setev2(int b)
- {
- if (b > 1913 && b < 1995) ev2 = b;
- else throw new Exception("Hibás évszám.");
- }
- //
- public int getev1()
- {
- return ev1;
- }
- public int getev2()
- {
- return ev2;
- }
- //
- public void setnem1(string c)
- {
- if (c == "m" || c == "f") nem1 = c;
- else throw new Exception("Hibás érték.");
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- ember e = new ember();
- e.setev1(1950);
- e.setev2(1960);
- e.setnem1(m);
- Console.WriteLine(e.getev1());
- Console.WriteLine(e.getev2());
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement