+
Skip to main content
+
+
{% include icons/icons.html %}
{% include components/sidebar.html %}
+
+
{% include components/header.html %}
+
+
{% include components/breadcrumbs.html %}
+
+
+
{% if site.heading_anchors != false %}
{% include vendor/anchor_headings.html html=content beforeHeading="true" anchorBody="" anchorClass="anchor-heading" anchorAttrs="aria-labelledby=\"%html_id%\"" %}
{% else %}
{{ content }}
{% endif %}
+
{% if page.has_children == true and page.has_toc != false %}
{% include components/children_nav.html %}
{% endif %}
+
+
{% include components/footer.html %}
+
+
{% if site.search_enabled != false %}
{% include components/search_footer.html %}
{% endif %}
+
{% if site.mermaid %}
{% include components/mermaid.html %}
{% endif %}
+
+
+
+ {% if page.include_programming_language_switch_script %}
+
+ {% endif %}
\ No newline at end of file
diff --git a/assets/js/programmingLanguageSwitch.js b/assets/js/programmingLanguageSwitch.js
new file mode 100644
index 0000000..f881130
--- /dev/null
+++ b/assets/js/programmingLanguageSwitch.js
@@ -0,0 +1,61 @@
+// Set the language preference in localStorage and update the displayed content immediately
+function setLanguagePreference(language, pagePath) {
+ // Set language preference in localStorage
+ localStorage.setItem('languagePreference_' + pagePath, language);
+ // Update the displayed content based on the selected language
+ showContent(language, pagePath);
+}
+
+// Get the language preference from localStorage
+function getLanguagePreference(pagePath) {
+ return localStorage.getItem('languagePreference_' + pagePath);
+}
+
+// Show the content based on the selected language
+function showContent(language, pagePath) {
+ // Map each language to its corresponding content element
+ var contentMap = {
+ 'cpp': 'cppContent',
+ 'csharp': 'csharpContent',
+ 'python': 'pythonContent'
+ };
+
+ // Iterate over each language in the contentMap
+ Object.keys(contentMap).forEach(function (key) {
+ // Get the content element based on the language
+ var contentElement = document.getElementById(contentMap[key]);
+
+ // Check if the content element exists
+ if (contentElement) {
+ // Set the display property based on whether it's the selected language
+ contentElement.style.display = (language === key) ? 'block' : 'none';
+ }
+ });
+
+ // Log a message indicating the switch to the specified language
+ console.log(`Switching to ${language} content`);
+}
+
+// Perform actions after the DOM has fully loaded
+document.addEventListener('DOMContentLoaded', function () {
+ // Get the current page path
+ var pagePath = window.location.pathname;
+ console.log('Page Path:', pagePath);
+
+ // Retrieve the saved language preference from localStorage
+ var savedLanguage = getLanguagePreference(pagePath);
+ console.log('Saved Language:', savedLanguage);
+
+ // If a language preference is saved, update the displayed content
+ if (savedLanguage) {
+ showContent(savedLanguage, pagePath);
+ }
+});
+
+// Set the language preference and update the displayed content on button click
+function setLanguageAndShowContent(language) {
+ // Get the current page path
+ var pagePath = window.location.pathname;
+ // Set the language preference in localStorage and update the displayed content
+ setLanguagePreference(language, pagePath);
+}
\ No newline at end of file
diff --git a/docs/Concepts/Memory.md b/docs/Concepts/Memory.md
index c1de2e1..9a26cbc 100644
--- a/docs/Concepts/Memory.md
+++ b/docs/Concepts/Memory.md
@@ -4,6 +4,7 @@ title: Memory
nav_order: 1
parent: Concepts
has_children: false
+include_programming_language_switch_script: true
---
{{ page.title }}
@@ -11,6 +12,19 @@ has_children: false
{% include under_construction.html %}
+
+
+ This is C++ content for Object-Oriented Programming.
+
+
+
+
+ This is C# content for Object-Oriented Programming.
+