can someone show me some examples with this class of constructors, methods and overload ??
define 2 employee and for the first one to rais the salary, then display the employees.
i`m very new to programming, i want to learn c#
and i want to know if i started right
- using System;
- namespace ConsoleApp1
- {
- class employee
- {
- public string name{ get; set; }
- private double Salary;
- public double salary
- {
- get { return Salary; }
- set
- {
- Salary= value;
- if (Salary< 0) Salary= 0;
- }
- }
-
- public employee(string _name= "Neinitializat", double _salary= 0)
- {
- salary= _salary;
- name = _name;
- }
-
- public produs (salary s)
- {
- salary= s.salary;
- nsme = s.name;
- }
- public void citire()
- {
- Console.WriteLine("NAme:"); name = Console.ReadLine();
- Console.WriteLine("Salary:");Salary=double.Parse(Console.ReadLine());
- }
- public void scriere()
- {
- Console.WriteLine(name + "," + Salary);
- }
- };
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- }