Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitf70e3c86df20907b7f4ac3561d29c115ede0d7ed (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-03-18 09:39:46 +0200
Committer
 Syndamia <kamen@syndamia.com>
2026-03-18 09:39:46 +0200
Files7ba8f7810b504ce8aeafc5124ad682627dc8f872
syndamia.com-f70e3c86df20907b7f4ac3561d29c115ede0d7ed.tar
syndamia.com-f70e3c86df20907b7f4ac3561d29c115ede0d7ed.tar.gz
syndamia.com-f70e3c86df20907b7f4ac3561d29c115ede0d7ed.zip
Parent9e78691898bdde389a5d1fb4e0b9e00b440d2b07 (diff)
feat(teaching/oop-2025/oop-notes): Initial contents
4 files changed, 106 insertions, 0 deletions
-rw-r--r--meta/meta.tsv1
-rw-r--r--src/teaching/oop-2025/index.du3
-rw-r--r--src/teaching/oop-2025/oop-notes/RuleOfFive.cpp54
-rw-r--r--src/teaching/oop-2025/oop-notes/index.du48
diff --git a/meta/meta.tsv b/meta/meta.tsv
index b43dc3b..38b5474 100644
--- a/meta/meta.tsv
+++ b/meta/meta.tsv
@@ -120,6 +120,7 @@ teaching/oop-2025/week02/index.html Задачи - ООП, Седмица 2, 25.
teaching/oop-2025/week03/index.html Задачи - ООП, Седмица 3, 04.03.2026 Условията на задачите за упражнение.
teaching/oop-2025/week04/index.html Задачи - ООП, Седмица 4, 11.03.2026 Условията на задачите за упражнение.
teaching/oop-2025/week05/index.html Задачи - ООП, Седмица 5, 18.03.2026 Условията на задачите за упражнение.
+teaching/oop-2025/oop-notes/index.html Бележки по ООП при C++ - ООП, КН, 2025-2026 Полезна информация и детайли относно обектно-ориентираното програмиране при C++
blog/connect-to-mysql-in-dotnet-ef/index.html Connect to MySql in .NET and Entity Framework Connecting a .NET application to a MySql database (with Entity Framework) can be tricky. Here is what works for me.
diff --git a/src/teaching/oop-2025/index.du b/src/teaching/oop-2025/index.du
index 71c87e8..fa6b58d 100644
--- a/src/teaching/oop-2025/index.du
+++ b/src/teaching/oop-2025/index.du
@@ -12,6 +12,9 @@
| [url https://github.com/18ivan18/ObjectOrientedProgramming2026 Материали от семинари]
| [url https://learn.fmi.uni-sofia.bg/course/view.php?id=12155 Курс в мудъл]
+[=Допълнителни ресурси:=]
+[url ./oop-notes Бележки по ООП при C++]
+
:table_3
|= &#8470;
|= Дата
diff --git a/src/teaching/oop-2025/oop-notes/RuleOfFive.cpp b/src/teaching/oop-2025/oop-notes/RuleOfFive.cpp
new file mode 100644
index 0000000..c29afe2
--- /dev/null
+++ b/src/teaching/oop-2025/oop-notes/RuleOfFive.cpp
@@ -0,0 +1,54 @@
+class X {
+ Y* elements;
+ unsigned elementsCount;
+
+ void free() {
+ delete[] elements;
+ }
+ void copyFrom(const X& other) {
+ elementsCount = other.elementsCount;
+
+ elements = new Y[elementsCount];
+ for (unsigned i = 0; i < elementsCount; ++i)
+ elements[i] = other.elements[i];
+ }
+
+public:
+ X() {
+ elements = nullptr;
+ elementsCount = 0;
+ }
+ ~X() {
+ free();
+ }
+ X(const X& other) {
+ copyFrom(other);
+ }
+ X& operator=(const X& other) {
+ if (this != &other) {
+ free();
+ copyFrom(other);
+ }
+ return *this;
+ }
+
+ X(X&& other) {
+ elements = other.elements;
+ elementsCount = other.elementsCount;
+
+ other.elements = nullptr;
+ other.elementsCount = 0;
+ }
+ X& operator=(X&& other) {
+ if (this != &other) {
+ free();
+
+ elements = other.elements;
+ elementsCount = other.elementsCount;
+
+ other.elements = nullptr;
+ other.elementsCount = 0;
+ }
+ return *this;
+ }
+};
diff --git a/src/teaching/oop-2025/oop-notes/index.du b/src/teaching/oop-2025/oop-notes/index.du
new file mode 100644
index 0000000..c3641fa
--- /dev/null
+++ b/src/teaching/oop-2025/oop-notes/index.du
@@ -0,0 +1,48 @@
+# Бележки по ООП при C++ - ООП, КН, 2025-2026
+
+'define expected-reading 2 min
+'define created 18 March 2026
+'define edited 18 March 2026
+[$pagenav]
+
+Този документ съдържа редица полезна информация и детайли относно обектно-ориентираното програмиране при C++.
+
+## Голяма петица формат
+
+```c++
+'include ./RuleOfFive.cpp
+
+## [`&&A`], rvalue и rvalue reference
+
+[`lvalue`] е всяка стойност, която има "име".
+Това са аргументи на функции, променливи, ...
+
+[`rvalue`] е всяка стойност за която нямаме "име".
+Най-често срещаните са върнатите стойноти от функция/оператор.
+Тези стойности са временни и идеята е че ще бъдат изтрити (и на практика, данните им ще бъдат копирани/пренесени в нещо с име, [`lvalue`]).
+
+Можем да правим референции върху [`rvalue`]:
+```c++
+A&& rvalueRef = functionWhichReturnsA();
+
+Обаче, тези референции дават (временно) име към [`rvalue`]-то.
+Това означава, че те самите стават [`lvalue`].
+
+Поради тази прична не можем да имаме повече от една [`rvalue`] референция към едно [`rvalue`]:
+```c++
+A&& ref1 = functionWhichReturnsA();
+A&& ref2 = ref1; // Грешка!
+
+И не можем да подаваме аргумент [`rvalue`] на друга функция:
+```c++
+void foo(A&& ref1) {
+ ...
+}
+void bar(A&& ref2) {
+ foo(ref2); // Грешка!
+}
+
+\n\n
+[*Съпътстващи ресурси:*]
+.bulleted
+- [url https://web.archive.org/web/20200627194253/https://thbecker.net/articles/rvalue_references/section_05.html https://thbecker.net/articles/rvalue_references/section_05.html]