-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
КМБО 03 21 Поляков А.А. новая ветвь #40
base: master
Are you sure you want to change the base?
The head ref may contain hidden characters: "\u041A\u041C\u0411\u041E-03-21_\u041F\u043E\u043B\u044F\u043A\u043E\u0432\u0410\u0410_\u043D\u043E\u0432\u0430\u044F_\u0432\u0435\u0442\u0432\u044C"
КМБО 03 21 Поляков А.А. новая ветвь #40
Conversation
electricity/electricity.cpp
Outdated
return false; | ||
else { | ||
pole->connectedObjectPole = ""; | ||
pole->connectedObject = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не отключаете другой объект от этого.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Общее замечание, не касаемо программирования: выключатель ставится до нагрузки (говоря умными словами, коммутирует фазу/плюс, для переменного/постоянного тока, соответственно), чтобы отключать её от потенциала на линии.
private: | ||
bool CanMoveFreely; | ||
public: | ||
Animal() { CanMoveFreely = 0; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не выполнен пункт задания с использованием protected
.
virtual string about() const { return (stringstream() << "CanMoveFreely =" << CanMoveFreely).str(); } | ||
|
||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нет перегрузки операции вывода в поток для Animal
.
memhacks/memhacks.cpp
Outdated
/// <summary> | ||
/// Выводит на экран адреса и размеры объекта типа <see cref="B"/> и его содержимого. | ||
/// Можно модифицировать для собственных отладочных целей. | ||
/// </summary> | ||
/// <param name="b">Изучаемый объект</param> | ||
void printInternals(const B& b) { | ||
void printInternals(B& b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если потребовалось отказаться от const
для метода, не подразумевающей изменение состояния объекта, то что-то явно сделано не так.
memhacks/memhacks.cpp
Outdated
} | ||
|
||
float A::getData(int idx) const { | ||
return ((float*)(this + 2))[idx]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему (this + 2)
?
memhacks/memhacks.h
Outdated
#include <ostream> | ||
#include <string> | ||
|
||
using namespace std; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Использовать using namespace
в заголовочных файлах нежелательно.
memhacks/memhacks.h
Outdated
|
||
public: | ||
std::string getBString() const; | ||
A(); | ||
virtual string getBString() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Идея как раз в том, чтобы продемонстрировать обход штатных (ограничений) средств языка для доступа к полям дочерних классов. В том числе и механизма виртуальных функций.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В корне неверно здесь и парой строчек ниже.
No description provided.