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

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.

মন্তব্যসমূহ

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

Machine Learning

 What is Machine Learning (ML)? When you face an interview it is is common the interviewer ask you a question regarding the definition of Machine Learning. I tried to find what could be the best answer. So, i am sharing with you. Machine Learning is a branch of Artificial Intelligence and Computer Science which focuses on the use of data and algorithms to imitate the way that humans learn, gradually improving its accuracy. It's all for today. If you like it please share with your friends and comment below. Thank you.

Green Economy: A solution for the Future Dhaka

Green economy is a recent idea of the modern world. Green economy is something that can generate growth and improvement in people's lives in ways consistent with  sustainable development. In fact, green economy reflects an overall development picture of a land or a country. Bangladesh has also been stirred by the induction of green economy. A green economy is one that results in improved human well being and social equity while significantly reducing environmental risk and ecological green economy is an economy or economic development and a knowledge of ecological economics. In the simplest expression, a green economy can be thought of as something which is low carbon resource, efficient and socially inclusive. Now Dhaka is facing a lot of problems. So, Dhaka needs green economy for solving all problems. With the passage of time, the UNEP led Green Economy in 2008. Green Economy Initiative consists of several components whose integrated overall objective is to provide the analysis ...

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...