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

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.

মন্তব্যসমূহ

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

Modern Technology and Globalization

Advances in technology are one of the main reasons that globalization has escalated in the past decade. In information and communication technology, innovations have become smaller in size, more efficient and often more affordable. In transport technology, vehicles have tended to become larger and faster, as well as becoming more environmentally friendly and cheaper to run. Whether for personal use or for business, technology has made the world seem a smaller place and assisted in the rise of globalization. The tends of technological changes have taken place since the industrialization revolution, relating from production, distribution and communication, that has fueled the globalization. It has brought about innovation and interaction between nations that weren't possible before. That has led to some of the greatest innovation and interaction between nations that weren't possible before. That has led to some of the greatest invention that revolutionized trade, communication ...

Bangladesh A Rising Economy

Bangladesh is a developing country. Bangladesh is now the world's 41th largest economy as per UK-based think tank Centre for Economics and Business Research (CEBR) . A great deal that has happened in the economy since independence in 1971 has supported the hope that the country will eventually overcome its dependence on foreign aid and approach relative self-sufficiency. Since the independence in 1971 Bangladesh has remarkably improved in agriculture sectors, RMG sectors, leather sectors and remittance sectors etc. Bangladeshis earn most of their living from agriculture. About 41% of Bangladeshis are involved in agriculture. Since the independence the overall effort by the government of Bangladesh to improve the agriculture sectors has noticeably been seen and for that Bangladeshi has improved the sector appropriate technology, modern agriculture system and improved agro-seeds and agro-machine. For that reason, the agriculture sectors have contribute and are still contributing in...