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;
- using System.Threading.Tasks;
- namespace BasicCsharp
- {
- class Person
- {
- public string fName;
- public string lName;
- public int age;
- public string origin;
- public Person(string fName, string lName, int age, string origin)
- {
- this.fName = fName;
- this.lName = lName;
- this.age = age;
- this.origin = origin;
- }
- public void showBio()
- {
- Console.WriteLine(fName + " " + lName + "\nAge: " + age + "\nOrigin: " + origin);
- }
- };
- class Employee : Person
- {
- public string fName;
- public string lName;
- public int age;
- public string origin;
- public string department;
- public double salary;
- public Employee(string fName,string lName, int age, string origin, string department,double salary)
- {
- this.department = department;
- this.salary = salary;
- }
- public void showBio()
- {
- Console.WriteLine("Department: " + department + "\nSalary: " + salary);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Person P1 = new Person("John","Doe",25,"None");
- P1.showBio();
- Employee E1 = new Employee("Abc","Def",40,"Earth","Basics",500.0);
- E1.showBio();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement