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.
মন্তব্যসমূহ
একটি মন্তব্য পোস্ট করুন