G
G
Grigory Ershov2018-08-05 20:33:19
OOP
Grigory Ershov, 2018-08-05 20:33:19

C2011 redefinition of the class type. 1 mistake. How to fix?

In general, all the code is currently working and does not produce syntax errors. But 1 "beautiful" error pops up "C2011 redefinition of class type". How to fix it, I have no idea. Please help. There is an error in the H file, there is nothing in cpp yet, I won’t even insert it.
5b673486443cc667495113.png

#include <iostream>
#include <string>
#include <conio.h>

using namespace std;

class Doctor
{
public:
  void SetDiagnos();
  void MenuOfDoctor();
  void WriteTheOrgan();
  string SetWhatTheOrgan();
};

class Aches
{
public:
  virtual void Options() = 0;
};
class Cancer : public Aches
{
public:
  void Options() override
  {
    Doctor *organ = new Doctor();
    organ->WriteTheOrgan();
    string Organ = organ->SetWhatTheOrgan();
    cout << "\t1. Химиотерапия\n"
      << "\t2. Антибиотики\n"
      << "\t3. Пересадка органа" << Organ << endl
      << "\t4. Обезболивающие\n"
      << "\t5. Домашний режим с супчиком\n\n"

      << "Что дальше?";
    switch (_getch())
    {
    case '1':
      
      break;
    case '2':

      break;
    case '3':

      break;
    case '4':

      break;
    case '5':

      break;
    }
  }
};
class Aids : public Aches
{
public:
  void Options() override
  {
  
  }
};
class SunStricke : public Aches
{
public:
  void Options() override
  {

  }
};
class HeadAche : public Aches
{
public:
  void Options() override
  {

  }
};
class Iche : public Aches
{
public:
  void Options() override
  {

  }
};

class Patient
{
private:
  string Ache;
  int Health;
public:
  string PationAche()
  {
    int B;
    B = 1 + rand() % 5;
    switch (B)
    {
    case (1):
    {
      Ache = "Cancer";
      break;
    }
    case (2):
    {
      Ache = "Aids";
      break;
    }
    case (3):
    {
      Ache = "HeadAche";
      break;
    }
    case (4):
    {
      Ache = "SunStricke";
      break;
    }
    case (5):
    {
      Ache = "Iche";
      break;
    }
    }
    return Ache;
  }
};

class Doctor
{
private:
  int Experience, IndeXOfDiagnos = 0, IndeXLookSimptoms = 0, IndeXOfAche = NULL;
  string PatientAche, Organ;
public:
  void Optoins(Aches *aches)
  {
    aches->Options();
  }

  void SetDiagnos()
  {
    if (IndeXLookSimptoms == 1)
    {
      cout << "\t1. Рак\n"
        << "\t2. Спид\n"
        << "\t3. Солнечный удар\n"
        << "\t4. Головная боль\n"
        << "\t5. Простуда\n\n"

        << "\t6. Вернуться в меню\n";
      switch (_getch())
      {
      case '1':
        IndeXOfDiagnos = 1;
        PatientAche = "Рак";
        IndeXOfAche = 1;
        break;
      case '2':
        IndeXOfDiagnos = 1;
        PatientAche = "Спид";
        IndeXOfAche = 2;
        break;
      case '3':
        IndeXOfDiagnos = 1;
        PatientAche = "Солнечный удар";
        IndeXOfAche = 3;
        break;
      case '4':
        IndeXOfDiagnos = 1;
        PatientAche = "Головная боль";
        IndeXOfAche = 4;
        break;
      case '5':
        IndeXOfDiagnos = 1;
        PatientAche = "Простуда";
        IndeXOfAche = 5;
        break;
      case '6':
        IndeXOfDiagnos = 0;
        break;
      }
      system("cls");
    }
    else cout << "Вы не можете поставить диагноз, до того, как ознакомитесь с симптомами -_- \n\n";
    return MenuOfDoctor();
  }

  void MenuOfDoctor()
  {
    cout << "\t1. Просмотреть симптомы\n"
     	<< "\t2. Просотреть мед.карту\n"
      << "\t3. Поставить диагноз\n"
      << "\t4. Назначить лечение\n\n"

      << "Что дальше?";

    switch (_getch())
    {
    case '1':
      system("cls");
      break;
    case '2':
      system("cls");
      break;
    case '3':
      system("cls");
      if (IndeXOfDiagnos == 1)
      {
        cout << "Диагноз уже стоит: " << PatientAche << endl << endl;
        MenuOfDoctor();
      }
      else SetDiagnos();
      break;
    case '4':
      system("cls");
      switch (IndeXOfAche)
      {
      case (1):
        Cancer cancer;
        Optoins(&cancer);
        break;
      case (2):
        Aids aids;
        Optoins(&aids);
        break;
      case (3):
        SunStricke sunstricke;
        Optoins(&sunstricke);
        break;
      case (4):
        HeadAche headache;
        Optoins(&headache);
        break;
      case (5):
        Iche iche;
        Optoins(&iche);
        break;
      }
      break;
    }
  }

  void WriteTheOrgan()
  {
    int IndeX;
    cout  << "Выберите стадию рака:\n\n"
      
      << "\t1. Первая (I)\n"
      << "\t2. Вторая (II)\n"
      << "\t3. Третья (III)\n"
      << "\t4. Четвёртая (IV)";
    system("cls");
    switch (_getch())
    {
    case '1':
      IndeX = 1;
      break;
    case '2':
      IndeX = 2;
      break;
    case '3':
      IndeX = 3;
      break;
    case '4':
      IndeX = 4;
      break;
    }
    if (IndeX == 3 || IndeX == 4)
    {
      cout << "Опухоль локализована?\n\n"
        << "1 - Да		2 - Нет";
      system("cls");
      switch (_getch())
      {
      case '1':
        cout << "Укажите орган в котором обнаружена первичная форма рака: ";
        getline(cin, Organ);
        break;
      case '2':
        Organ = "";
        break;
      }
    }
    else Organ = "";
  }
  string SetWhatTheOrgan()
  {
    return Organ;
  }
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-08-05
@MentTea

Trying to define two classes with the same name. Well, or the same class twice. So either rename one of the classes, or delete it - that's up to you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question