نصائح و استشارات برمجية
Открыть в Telegram
• نصائح واستشارات برمجية متعلقة باسئلة تم طرحها • لطرح استفسار او سؤال: @m4md24
Больше1 443
Подписчики
-224 часа
-77 дней
+530 день
Архив постов
• الـ Distractor أو Deconstructor هما مصطلحات في لغة C++ عبارة عن دوال خاصة تستخدم لفصل مكونات الكائن (Object) لأجزائه الفردية.
• و لما تقوم بإنشاء كائن من نوع معين، تقدر انك تستخدام الـ Deconstructor لتحرير الموارد اللي تم استخدامها خلال حياة الكائن.
و دا مثال بسيط على كيفية تعريف Deconstructor في C++:
#include <iostream>
class MyClass {
public:
// Constructor
MyClass() {
std::cout << "Constructor called" << std::endl;
}
// Destructor (Distractor)
~MyClass() {
std::cout << "Destructor called" << std::endl;
}
};
int main() {
// Creating an object of MyClass
MyClass myObject;
// The object will be destroyed when it goes out of scope
// and the destructor will be called
return 0;
}
• المثال دا بيتم طباعة "Constructor called" لما يتم إنشاء الكائن و"Destructor called" لما يتم تدميره او انتهائه لما يخرج من نطاق البرنامج الرئيسي (main).#include <iostream>
using namespace std;
class publiction {
protected:
string title;
float price;
public:
publiction(string n, float p) {
title = n;
price = p;
}
};
class Book : public publiction {
protected:
int pageCount;
public:
Book(string n, float pri, int page) : publiction(n, pri) {
pageCount = page;
}
void display() {
cout << "The Title Of Book Is " << title << endl;
cout << "The Price Of Book = " << price << "$" << endl;
cout << "The Number Of Page = " << pageCount << endl;
}
};
class Tape : public publiction {
protected:
float time;
public:
Tape(string n, float p, float m) : publiction(n, p) {
time = m;
}
void displaytime() {
cout << "The Time You Need = " << time << " Minutes" << endl;
}
};
int main() {
string n;
float a, b;
int x;
cout << "Enter The Title" << endl;
cin >> n;
cout << "Enter The Price" << endl;
cin >> a;
cout << "Enter The Time" << endl;
cin >> b;
cout << "Enter The Number Of Page " << endl;
cin >> x;
Book obj(n, a, x);
Tape g(n, a, b);
obj.display();
g.displaytime();
return 0;
}#include <iostream>
using namespace std;
class publiction{
protected:
string title;
float price;
public:
publiction(string n,float p){
title=n;
price=p;
}
};
class Book:public publiction{
protected:
int pagecount;
public:
Book(string n,float pri,int page):publiction(n,pri){
pagecount=page;
}
void display(){
cout<<"The Title Of Book Is "<<title<<endl;
cout<<"The Price Of Book = "<<price<<"$"<<endl;
cout<<"The Number Of Page = "<<pagecount<<endl;
}
};
class Tape:public publiction{
protected:
float time;
public:
Tape(float m):publiction(){
time=m;
}
void displaytime(){
cout<<"The Time You Need = "<<time<<" Minutes"<<endl;
}
};
int main(){
int x;
string n;
float a,b;
cout<<"Enter The Title"<<endl;
cin>>n;
cout<<"Enter The Price"<<endl;
cin>>a;
cout<<"Enter The Time"<<endl;
cin>>b;
cout<<"Enter The Number Of Page "<<endl;
cin>>x;
Book obj(n,a,x);
Tape g(b);
obj.display();
g.displaytime();
return 0;
}
• من اليوتيوب، و من اي منصة دورات تعليمية زي Udemy و Udacity
• و تقدر تشوف الموقع دا ⬇️:
m3md69.github.io/NULLEXIA
فيه دورات تعليمية لناس بتعرف تشرح .. كل اللي عليك انك تروح لقسم التعلم و تختار اللي عايزه .. الناس اللي بتشرح مختارهم بنفسي
عندي واجب اني اكتب كود بلغه جافا
وانا تحضيري حرفيا صفر ولا شيء فاهمته كيف اقدر اكتبه بنفسي؟ من وين اقدر اتعلم لغة جافا عشان بحل الواجب
• علامتين ++ بعد المتغير كدا ⬇️
a++
• معناها انه هيزود واحد بس لما يتم استدعاء المتغير بعد المرة اللي جايه، يعني من تاني مرة هنستدعي فيها المتغير هيقون مزود الواحد اللي خزنهوله، زي كدا ⬇️
int a = 1;
cout << a++ <<endl;;
cout << a++;
-----
1
2
■■■■■■■■
• علامتين ++ قبل المتغير كدا ⬇️
++a
• معناها انه هيزود واحد على طول، اول ما بتم استدعائه من اول مرة، زي كدا ⬇️
int a = 1;
cout << ++a <<endl;
cout << ++a;
-----
2
3
Уже доступно! Исследование Telegram 2025 — ключевые инсайты года 
