কম্পিউটার টিউটোরিয়াল

C++-এ ট্রিভিয়াল ক্লাস


এই টিউটোরিয়ালে, আমরা 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.)

  1. C++-এ ডায়াগোনাল ট্রায়ভার্স II

  2. প্রসেস কিল করা (Kill Process) C++-এ

  3. স্কোয়ারেল সিমুলেশন (Squirrel Simulation) C++-এ

  4. C++-এ আয়তাকার এলাকা II (Rectangle Area II) সমাধান