V
V
VerNika2015-11-03 19:54:10
Programming
VerNika, 2015-11-03 19:54:10

OOP. How to properly organize the connection of classes?

In general there are three classes:

Пространство имён ЕГЭ
{
  Класс Образовательное_учреждение
  {
    Строка Название_ОУ;
    Число Номер_ОУ;
    Коллекция Ученики;
  }
  Класс Ученик
  {
    Строка Фамилия, Имя, Отчество;
    Символ Пол;
    Число Номер_паспорта;
    Коллекция Предметы;
  }
  Класс предмет
  {
    Строка Название;
    Дата Дата_сдачи;
    Число Первичный_балл, Итоговый_балл;
  }
}

It is necessary to demonstrate some of the features of OOP, namely:
  1. Friendly features;
  2. Static methods;
  3. Constructors, destructors;
  4. Exceptions;
  5. interfaces;
  6. templates;
  7. Abstract classes and their abstract/virtual functions and their inheritance;

Actually, the question arises only on the last point, where is it more adequate to implement an abstract class with its methods? And that it is inherited by one of our classes? And of course, to leave room for interfaces.
These classes are not reference, you can freely add a new class and / or change the fields of these classes. The implementation will be in C ++, C #, Java, so it is advisable to proceed from their capabilities.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AtomKrieg, 2015-11-03
@VerNika

The subject class has an abstract method that returns a name. Descendant classes "Mathematics", "Physics", "Informatics" implement them

S
Sergey, 2015-11-03
Protko @Fesor

in order for an abstract class to be needed, you must have two implementations of the same interface that have duplication.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question