সরাসরি প্রধান সামগ্রীতে চলে যান

OOP in C++ (Class and Object)

  Class and Object

Hello, in this article we will try to discuss about Class and object in C++ programming. All of you have known that class and object is the most important part in Object oriented programming. So, it is very important for us to know it sharp and clear. Let's discuss about it.


Suppose, you are a human right? I think you have no doubt about it! You may have heard in biology class that we are human and the class of human is Homo Sapiens. You have pet, right? It could be Doggy or Catty! They are animal but they are not Homo Sapiens. Also you see birds are flying in the sky they are also animals but they are not Homo Sapiens. All of them has some specific class. This class had made them unique according to their characteristics. So, the scientist have divided the class according to their property so that you can easily understand about the class. Now you have gathered some ideas about class. 


You are a student, right? How could you define any person as a student? If he wear a school dress or hanging a bag in his shoulder, having some books in his hand then we can guess the person as a student. As a whole as a student you must have an ID, ROLL Number, Dress, Name and so on. Considering you as a student we can find property in you. We can understand it easily. But our aim is to tell the computer about it, so now lets try-


So, what we did here? We declared a class which name is student and then we have given some property of the student class. Remember one thing, when declaring class you have to use define your class as public otherwise it will become private by default and you will not be able to access it. And lastly from the main function we create an object of the student class named Jacob. And using this object we can use the class by assigning some values in it. And lastly we printed out those values.



It was all about Class and Object. Please let me know if you have any queries about it. 


Thank you.

মন্তব্যসমূহ

এই ব্লগটি থেকে জনপ্রিয় পোস্টগুলি

The Challenges of achieving Middle income Country status for Bangladesh

Bangladesh has got it's independence from Pakistan in 1971 through a nine month long bloody war. Bangladesh was ruled by the unconstitutional power till 1990 and then came back into a democratic country with some interruptions. Up to 1990, the GDP growth of Bangladesh was well below potential. But in the mid 90s, the economy slowly emerged and there has been observed a shift form the agriculture-led development to manufacturing and services sector let growth Bangladesh has recently celebrated 50 years of its independence in 2021. The country crafted vision-2021 in order to mark the celebration which is mainly focused to achieve the middle Income country (MIC) status by the  timeline. With a view to reaching the cherished and desire vision, the country formulated long term perspective plan 2021-2041. The world bank classifies economic status of countries as: low income, lower middle income, upper middle income and high income countries. According to the method of measuring the sta...

Bangla to English Translation

যে কোন দেশের উন্নয়নের ক্ষেত্রে যোগাযোগ ব্যবস্থার গুরুত্ব অপরিসীম। ‍যোগাযোগের ক্ষেত্রে প্রতিবন্ধকতা থাকলে প্রতিটি কাজের অগ্রগতি ব্যহত হয়। বর্তমানে উন্নত বিশ্বে কম্পিউটার নেটওয়ার্কের মাধ্যমে যোগাযোগ নিয়ন্ত্রিত হচ্ছে। বিশেষ করে আকাশ পথে বিমান আর সমুদ্রগামী জাহাজ কম্পিউটার ও বেতারযন্ত্র ছাড়া নিয়ন্ত্রনের ‍উপায় নেই । এক দেশের সাথে আরেক দেশের দ্রুত যোগাযোগের মাধ্যম  ইন্টারনেট । ডিজিটাল পদ্ধতি প্রতিষ্ঠিত হলে  এক্ষেত্রে বড় ধরনের সাফল্য আসতে পারে । এভাবে সমগ্র পৃথিবীকে হাতের মুঠোয় আনা সম্ভব।  Important of communication system is immense for the development of any country. Advancement of every work is obstructed if there is any restriction in communication. Presently, in the developed world, communication is being constructed by computer network. Specially there is no other way to control aircrafts in the sky and ships in the sea without computer and wireless network. The medium of fast communication with one country to another is internet. A huge success will come in this...