Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApplication1
- {
- class Person
- {
- private string _firstName;
- protected string _lastName;
- public Person(string firstName, string lastName)
- {
- this._firstName = firstName;
- this._lastName = lastName;
- }
- public string GetName()
- {
- return string.Format("Name: {0}, Last-Name: {1}", this._firstName, this._lastName);
- }
- }
- class Employee : Person
- {
- private int _stuffNum;
- public Employee(string firstName, string lastName, int stuffNum)
- : base(firstName, lastName)
- {
- _stuffNum = stuffNum;
- }
- public string GetEmployeeInfo()
- {
- Console.WriteLine("this: " + this._lastName);
- Console.WriteLine("Base: " + base._lastName);
- return base.GetName() + ", " + this._stuffNum;
- }
- }
- class Program
- {
- static void Main()
- {
- var p1 = new Person("Ivandro", "Ismael");
- var e1 = new Employee("John", "Paul", 10);
- Console.WriteLine(p1.GetName());
- Console.WriteLine(e1.GetEmployeeInfo());
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement