mardi 13 décembre 2022

Template Pattern how to update each method status in Main Method c# Windows App

Template Pattern how to update each method status in Main Method c# Windows App


using System; namespace TemplateMethodDesignPattern { public abstract class HouseTemplate { // Template method defines the sequence for building a house public void BuildHouse() { BuildFoundation(); BuildPillars(); BuildWalls(); BuildWindows(); Console.WriteLine("House is built"); }

    // Methods to be implemented by subclasses
    protected abstract void BuildFoundation();
    protected abstract void BuildPillars();
    protected abstract void BuildWalls();
    protected abstract void BuildWindows();
}

}

on Main method i wanted to show each method status/output based on progress in listbox c#

tried with delegates but didn't succeeded.

Aucun commentaire:

Enregistrer un commentaire