M
M
Maxim2017-05-08 12:44:22
OOP
Maxim, 2017-05-08 12:44:22

Where did the interface methods go?

interface IView
{
  void Show();
  void Close();
}

interface IStartView: IView
{
  String[] A{get; set;}
}

class StartView: Form, IStartView
{
  String[] A{get; set}
  //...
}

How to "place" the Show/Close methods from IView in the StartView class?
Changing the interface of IStartView
interface IStartView: IView
{
  String[] A{get; set;}
  void Show();  //Ошибка
  void Close(); //Ошибка
}

Надо добавить слово new, которое тут не нужно.
Changing the StartView class
class StartView: Form, IView, IStartView
{
  //....
}

Предлагает убрать IView

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem, 2017-05-08
@devspec

There is such a magic button in VS:
If you are not in VS, then here:

class StartView : IStartView
    {
        string[] IStartView.A
        {
            get
            {
                throw new NotImplementedException();
            }

            set
            {
                throw new NotImplementedException();
            }
        }

        public void Close()
        {
            throw new NotImplementedException();
        }

        public void Show()
        {
            throw new NotImplementedException();
        }
        //...
    }

D
Dmitry Eremin, 2017-05-11
@EreminD

class StartView : IStartView
    {
        public void IView.Close()
        {
            //...
        }
///...
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question