Пример #1
0
    static void Main(string[] args)
    {
        ITextProcessor processor = new FileProcessor();
        string         result    = processor.ReadText();

        processor.SaveText(result);


        ITextProcessor processorTest = new FileProcessorTest();

        // cast processorTest as the specific type to access the extra method
        ((FileProcessorTest)processorTest).testMethod()
    }
    static void Main(string[] args)
    {
        ITextProcessor processor = new FileProcessor();
        string         result    = processor.ReadText();

        processor.SaveText(result);

        ITextProcessor processorTest = new FileProcessorTest();

        if (processorTest is FileProcessorTest)
        {
            ((FileProcessorTest)processor).testMethod();
        }
    }