Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
АФТИ ООП 2013-2014. Лекция I/06
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Oleg Dashevskii
October 14, 2013
Education
0
150
АФТИ ООП 2013-2014. Лекция I/06
Oleg Dashevskii
October 14, 2013
Tweet
Share
More Decks by Oleg Dashevskii
See All by Oleg Dashevskii
Лекция № 13. Практическое руководство по разработке
be9
0
1.6k
Лекция № 12. Ещё о проектировании
be9
0
1.5k
Лекция № 11. Принцип отделения интерфейса. «Малое ООП»
be9
0
1.5k
Лекция № 10. Графическая нотация. Принципы LSP и DIP
be9
0
1.6k
Лекция № 9. Отношения между классами. Принцип открытия-закрытия
be9
0
1.5k
Лекция № 8. Хорошие и плохие ОО-программы
be9
0
1.5k
Лекция № 7. algorithm. Исключения
be9
1
1.5k
Лекция № 6. Стандартная библиотека C++. Часть 2
be9
0
1.6k
Лекция № 5. Стандартная библиотека C++. Часть 1
be9
0
1.6k
Other Decks in Education
See All in Education
20251119 如果是勇者欣美爾的話, 他會怎麼做? 東海資工
pichuang
0
170
自己紹介 / who-am-i
yasulab
PRO
5
6.3k
Design Guidelines and Models - Lecture 5 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.3k
Semantic Web and Web 3.0 - Lecture 9 - Web Technologies (1019888BNR)
signer
PRO
2
3.2k
Leveraging LLMs for student feedback in introductory data science courses (Stats Up AI)
minecr
0
160
2025-10-30 社会と情報2025 #05 CC+の代わり
mapconcierge4agu
0
110
1021
cbtlibrary
0
400
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
JavaScript - Lecture 6 - Web Technologies (1019888BNR)
signer
PRO
0
3.1k
Linguaxes de programación
irocho
0
530
Security, Privacy and Trust - Lecture 11 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Human Perception and Cognition - Lecture 4 - Human-Computer Interaction (1023841ANR)
signer
PRO
0
1.3k
Featured
See All Featured
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
49k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
110
Done Done
chrislema
186
16k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
350
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
270
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.6k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
55
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
420
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Ruling the World: When Life Gets Gamed
codingconduct
0
140
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.8k
First, design no harm
axbom
PRO
2
1.1k
Transcript
ОБЪЕКТНО- ОРИЕНТИРОВАННОЕ ПРОГРАММИРОВАНИЕ Лекция № 6 14.10.2013 г.
В ПРОШЛОЙ СЕРИИ • Single responsibility principle (SRP). • Наследование,
агрегация, композиция, ассоциация. • Задача 1. Применение ООП к stdio.h. • Задача 2. «Малое ООП». Задача линейной аппроксимации множества точек.
ПОТОКИ В C++ ios_base ios istream ostream iostream istringstream ifstream
filebuf
ПОТОКИ В QT QObject QIODevice QFile QTextStream QBuffer QProcess QAbstract
Socket и др.
class LinearRegression { public: LinearRegression(const QPointF *_points, int _size); LinearRegression(const
QVector<QPointF> &_points); // y=Ax+B double a(); double b(); QPointF point(double x) { return QPointF(x, a()*x+b()); } double mse(); double std(); protected: void calculate(); /****/ const QPointF *points; int size; bool ready; double _a, _b; };
ЗАДАЧА 2’ Проектирование класса для линейной экспоненциальной аппроксимации набора точек
class BaseRegression { public: BaseRegression(const QPointF *_points, int _size); BaseRegression(const
QVector<QPointF> &_points); virtual double y(double x)=0; QPointF point(double x) { return QPointF(x, y(x)); } double mse(); double std(); protected: /****/ const QPointF *points; int size; };
class ExponentialRegression : public BaseRegression { public: ExponentialRegression(const QVector<QPointF> &points);
// y=A*exp(B*x) double a(); double b(); double y(double x) { return a()*exp(b()*x); } protected: void calculate(); /****/ bool ready; double _a, _b; };
void ExponentialRegression::calculate() { QVector<QPointF> logpoints(size); for (int i = 0;
i < size; ++i) logpoints[i] = QPointF(points[i].x(), log(fabs(points[i].y()))); LinearRegression lr(logpoints); _b = lr.a(); _a = exp(lr.b()); if (size > 0 && points[0].y() < 0) _a *= -1; ready = true; }
void ExponentialRegression::calculate() { QVector<QPointF> logpoints(size); for (int i = 0;
i < size; ++i) logpoints[i] = QPointF(points[i].x(), log(fabs(points[i].y()))); LinearRegression lr(logpoints); _b = lr.a(); _a = exp(lr.b()); if (size > 0 && points[0].y() < 0) _a *= -1; ready = true; } Композиция
ЗАДАЧА 3 ОО-дизайн для задачи сортировки
КОНЕЦ ШЕСТОЙ ЛЕКЦИИ