КМБО 03 21 Поляков А.А. новая ветвь#40
Hidden character warning
Conversation
electricity/electricity.cpp
Outdated
| return false; | ||
| else { | ||
| pole->connectedObjectPole = ""; | ||
| pole->connectedObject = nullptr; |
There was a problem hiding this comment.
Не отключаете другой объект от этого.
electricity/electricity.cpp
Outdated
| Lamp lamp_test; | ||
| Switch switch_test; | ||
| generator_test.connect("A1", lamp_test, "A1"); | ||
| lamp_test.connect("A2", switch_test, "A1"); |
There was a problem hiding this comment.
Общее замечание, не касаемо программирования: выключатель ставится до нагрузки (говоря умными словами, коммутирует фазу/плюс, для переменного/постоянного тока, соответственно), чтобы отключать её от потенциала на линии.
| private: | ||
| bool CanMoveFreely; | ||
| public: | ||
| Animal() { CanMoveFreely = 0; } |
There was a problem hiding this comment.
Не выполнен пункт задания с использованием protected.
| virtual string about() const { return (stringstream() << "CanMoveFreely =" << CanMoveFreely).str(); } | ||
|
|
||
| }; | ||
|
|
There was a problem hiding this comment.
Нет перегрузки операции вывода в поток для Animal.
memhacks/memhacks.cpp
Outdated
| /// </summary> | ||
| /// <param name="b">Изучаемый объект</param> | ||
| void printInternals(const B& b) { | ||
| void printInternals(B& b) { |
There was a problem hiding this comment.
Если потребовалось отказаться от const для метода, не подразумевающей изменение состояния объекта, то что-то явно сделано не так.
memhacks/memhacks.cpp
Outdated
| } | ||
|
|
||
| float A::getData(int idx) const { | ||
| return ((float*)(this + 2))[idx]; |
memhacks/memhacks.h
Outdated
| #include <ostream> | ||
| #include <string> | ||
|
|
||
| using namespace std; |
There was a problem hiding this comment.
Использовать using namespace в заголовочных файлах нежелательно.
memhacks/memhacks.h
Outdated
| public: | ||
| std::string getBString() const; | ||
| A(); | ||
| virtual string getBString() const; |
There was a problem hiding this comment.
Идея как раз в том, чтобы продемонстрировать обход штатных (ограничений) средств языка для доступа к полям дочерних классов. В том числе и механизма виртуальных функций.
vectors/vector.h
Outdated
| std::ostream& operator <<(std::ostream& os, const vector3d& v); | ||
| #include <iostream> | ||
| using namespace std; | ||
| int main() { |
There was a problem hiding this comment.
Почему main() в заголовочном файле?
vectors/vector.cpp
Outdated
| { | ||
| if ((data[0] == 0) && (data[1] == 0) && (data[2] == 0)) | ||
| { | ||
| return vector3d(data[0] = 1, data[1] = 1, data[2] = 1); |
There was a problem hiding this comment.
В корне неверно здесь и парой строчек ниже.
No description provided.