clinically-proven

Abstract

Nov 21st, 2020 (edited)
900
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.08 KB | None | 0 0
  1. // retrieve from database
  2. // existing functions:
  3.  
  4. // DatabaseFeature (class)
  5. // - connectToDatabase
  6.  
  7.  
  8. // 1. GET EMPLOYEES
  9. // connect to database
  10. // get employees
  11.  
  12. // 2. UPDATE EMPLOYEE
  13. // connect to database
  14. // update employe
  15.  
  16. using System;
  17. using System.Collections.Generic;
  18.  
  19. namespace Demoabstraction
  20. {
  21.     // abstract class
  22.     abstract class DatabaseFeature
  23.     {
  24.         // abstract method
  25.         public abstract int connectToDatabase();
  26.     }
  27.  
  28.     // square class inherting
  29.     // the Shape class
  30.     class GetEmployees : DatabaseFeature
  31.     {
  32.         public override int connectToDatabase()
  33.         {
  34.             // connect to database stuff
  35.             throw new NotImplementedException();
  36.         }
  37.  
  38.         public int getEmployeeCount()
  39.         {
  40.             connectToDatabase();
  41.             int employeeCount = 100; // dummmy
  42.             return employeeCount;
  43.         }
  44.  
  45.         public List<string> getEmployeeNames()
  46.         {
  47.             connectToDatabase();
  48.             List<string> employees = new List<string>();
  49.  
  50.             //retrieve employee names
  51.            
  52.             return employees;
  53.         }
  54.     }
  55.  
  56.     class UpdateEmployee : DatabaseFeature
  57.     {
  58.         public override int connectToDatabase()
  59.         {
  60.             // connect to database stuff
  61.             throw new NotImplementedException();
  62.         }
  63.  
  64.         public void updateEmployeeName(string firstName, string lastName, string middleName)
  65.         {
  66.             connectToDatabase();
  67.             // update employee's name
  68.         }
  69.  
  70.         public void updateEmployeeCredentials(string username, string password)
  71.         {
  72.             connectToDatabase();
  73.             // update employee's credentials (username, password)
  74.         }
  75.     }
  76.     // Driver Class
  77.     class SampleClass{
  78.      // Main Method
  79.         static void Main(string[] args) {
  80.            
  81.             UpdateEmployee update = new UpdateEmployee();
  82.            
  83.             // calling the method
  84.             GetEmployees employees = new GetEmployees();
  85.  
  86.         }
  87.     }
  88. }
Add Comment
Please, Sign In to add comment