এই টিউটোরিয়ালে, আমরা C++ এ তুচ্ছ ক্লাস বোঝার জন্য একটি প্রোগ্রাম নিয়ে আলোচনা করব।
যখন একটি ক্লাস/স্ট্রাকট এর ভিতরে স্পষ্টভাবে ডিফল্ট মান থাকে, তখন এটি তুচ্ছ ক্লাস হিসাবে পরিচিত। আরও তুচ্ছ ক্লাসের নিজস্ব কনস্ট্রাক্টর, অ্যাসাইনমেন্ট অপারেটর এবং ডেস্ট্রাক্টর আছে।
উদাহরণ
//using the default constructor
struct Trivial {
int i;
private:
int j;
};
//defining your own constructor
//and then marking it as default
struct Trivial2 {
int i;
Trivial2(int a, int b){
i = a;
}
Trivial2() = default;
}; আউটপুট
(No output as we are just defining classes here and not creating object instances from them.)