Q: How to inherit a method from the child class to the parent? I have a Parent class which initializes the opening of the website I have automated using Selenium and c#.  So all the child methods (separate class files) inherit the Parent to launch the website and configure the application.  Within the Parent class, I want to call a method MultipleAddVehicle(); from a child class.  How do I do this.  Here is the code of the parent class and the child method I want to call:
        [TestInitialize]
        public void BaseTestInit()
        {
            // create chrome driver
            driver = new ChromeDriver(".");
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(45);
            driver.Manage().Window.Maximize();

            // create class for commonly used components / functions
            objCommon = new clsCommon(driver);
            _userSetRepo = new UserSetttingsRep(driver);

            LoginAndSelectAutomationFleet();
        }

        public void LoginAndSelectAutomationFleet()
        {
            // login the user
            objCommon.loginVT(driver);
            System.Threading.Thread.Sleep(3000);

            Actions builder = new Actions(driver);
            builder.MoveToElement(_userSetRepo.userIcon).Click().Build().Perform(); //Hover on System 

            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.XPath(UserSetttingsRep.InputOrganisationSelector)));

            objCommon.SendKeysAndClickTab(_userSetRepo.inputOrgansiation, "M-Powered Automation", driver);
            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(By.XPath(UserSetttingsRep.InputOrganisationSelector)));
        }
        public void GenerationTestData()
        {
            //First data that is needed is vehicle management data
            //Add multiple vehicles and add unassigned devices and unassigned drivers
           **MultipleAddVehicle();**

    }

        [TestCleanup]
        public void TestCleanUp()
        {
            driver.Quit();
            objCommon.ValidateResult();
        }
    }
}

I want to call the child method from a different class in the parent class by creating a method in the parent class:
public void MultipleAddVehicle()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            Actions builder = new Actions(driver);
            builder.MoveToElement(_regRep.SystemIcon).Click().Build().Perform(); //Hower on System       }

            System.Threading.Thread.Sleep(8000);
            _vechRep.VehicleMgmtLink.Click();
            string[] array = { "AK12 OLX", "FN53 KTO", "OU03 TGX", "BF14 YDS" };
            // Loop with foreach and write colors with string interpolation.
            foreach (string VRN in array)
            {


                //_vechRep.SearchVehicle.Click();
                System.Threading.Thread.Sleep(5000);
                _vechRep.AddNewVehicle.Click();
                _vechRep.VRNSearch.SendKeys(VRN);
                _vechRep.FindVehicle.Click();
                System.Threading.Thread.Sleep(2000);
                _vechRep.VehicleTypeOption.SendKeys("Car");
                _vechRep.VehicleTypeOption.SendKeys(Keys.Tab);
                System.Threading.Thread.Sleep(1000);
                _vechRep.VehicleColor.SendKeys("Red");
                _vechRep.btnAddVehicle.Click();
                System.Threading.Thread.Sleep(2000);
                try
                {
                    if (_vechRep.VehicleAddSuccessMsg.Displayed)
                    {
                        Console.WriteLine("Vehicle is successfuly added");
                    }
                }
                catch
                {
                    Console.WriteLine("Vehicle is NOT added");
                    Assert.Fail();
                }
            }
        }

This is the method I am trying to create and use the mthod in the parent class
public void GenerationTestData()
        {
            //First data that is needed is vehicle management data
            //Add multiple vehicles and add unassigned devices and unassigned drivers
           **MultipleAddVehicle();**

I get this does not exist in its current context

A: Define MultipleAddVehicle as an abstract method in the parent class, and override it in the child class. This will require you to define the parent class as an abstract class:
public abstract class Parent
{
    public abstract void MultipleAddVehicle();

    [TestInitialize]
    public void BaseTestInit()
    {
        // ...
    }

    public void LoginAndSelectAutomationFleet()
    {
        // ...
    }

    public void GenerationTestData()
    {
        //First data that is needed is vehicle management data
        //Add multiple vehicles and add unassigned devices and unassigned drivers
        MultipleAddVehicle();
    }
}

public class Child : Parent
{
    public override void MultipleAddVehicle()
    {
        // ...
    }
}

This is just good old fashioned object oriented programming. No magic here.
This is very similar to the Template Method Pattern.

A: Child class see all members of parent class, but parent class dont see all members of child class, unless it have access to child class object. If child classs is not a static class, then you must create an instance of child class and put a reference on it into parent class. If all classes are in same namespace, they will be visible to each other.
public class ParentClass
{
    .................................


    public ChildClass childclassinstance;

    public void GenerationTestData()
        {
            //First data that is needed is vehicle management data
            //Add multiple vehicles and add unassigned devices and unassigned drivers
            childclassinstance.MultipleAddVehicle();
        }
}

public class ChildClass : ParentClass
{
     public void MultipleAddVehicle()
        {
        }
}

Of course, you need to initialize your childclassinstance object before calling it's methods. You may do it from parent class by default constructor, if you dont care about this specific object values, and just want to call one void method.
public ChildClass childclassinstance = new ChildClass();

Or you may initialize it from child class if it is created during testing
childclassinstance = this;

Or you can make MultipleAddVehicle(); a static method, so you do not need to create object, just call it from class type.
ChildClass.MultipleAddVehicle();

