Skip to main content

What is Class and Object in Oops || definition of Classes & Objects



We can make a program in Procedure oriented like C . But when C++ comes and says about Object Oriented Programming Language( Oops ) , then Class & Object comes into picture .

If we want to make a program in object oriented,then we must have to know about Class & Object which is main attributes of Oops . If you don't know much about it, don't worry . Take a seat , and let's start .

 Class is a blueprint of Object where Object is a real world entity . Now whoever reading this blog , consider that I am a Object , that's great .. Now let's see with an example below then will discuss rest

 
..

      So if I consider Human as a Class & myself as an Object , then its definite I must be some properties and behavior .. So here we can say skin color , age , eye color , height etc as properties of myself . I am 22 year's old so 22 year's is an property and I can talk so here talk() is an function ( behavior ) of myself . So there are some common attributes or characteristics which can define me or which can define a Object is called Class .
  So we can say that Class is a blueprint of an Object which stores properties and functionalities of an Object mean what can Object do actually and what things present in an Object whereas these properties and functionalities are implemented by something which is nothing but Object .
 
So a Class can have many Objects . We can say that Class is a data-type and Object is Class type Variable ,let's see with an example below :




         So in the above example a Class Person has defined,and then P1 means object of that class has been created . And I have shown you also int type variable c,and I have compared it with object P1 , cause Person class also defining the type of P1(object) , which works as same as integer .
 
   We can say finally , aobject is nothing but an instance of a class. A class can be defined as a template or we can say as a blueprint that defines the behavior or state that the object holds .
Keep Practice it .

Please visit my Youtube Videos link given below :
  https://www.youtube.com/channel/UCC_SnAOTQP7uckcZR_3QMcQ/featured   

Please follow my Facebook Page link given below :
   https://www.facebook.com/Code-Religion-795982750772492

     Keep Learning ..:)
     Thank You .
   

Comments

Popular posts from this blog

Text Formatting || Fonts in HTML

We all know that we can write Paragraphs in HTML with many tags , like  <p> , <span> etc. But what the point is if we think about its formatting , for example how to change a text color,how to resize a text .Don't know ? well take a sit ,we will discuss about it briefly , Lets Start ...  First talk about how to resize a font and change it's color also set it's alignment . Please note a point before that in HTML only 3 types of alignments are there : a- left , b- right , c- center  We will go through this line with ' p ' tag: "Hello World! Wake up and do your work hard" .    First set it's alignment ,I am showing a example below :      So,we can see the above example where I have put all three alignments with same line .First one will show at the left hand side ,second one will show at the center ,and last one will show at the right side .Now see the output of this example below :   Wow , it sho...

What is a tag or anchor tag in HTML ?

We all can create a HTML page , right ? But What If I want to connect two HTML pages ? Good question.. Don't Worry ,We will discuss about it now .So please take a seat . Let's start .   So , when we want to connect two pages then <a> tag comes in picture.Through this tag we can connect between two HTML document (pages) ,we also can connect an external image and also we can put any website's link.Well ,but where to put the links and also what is <a> tag .  Well , <a> tag is nothing but an element is called anchor element .And it has a attribute is "href (hyper reference)" where we can put the address or the link that where we want to go or we connect with that particular page . But how ..... That I will show you too .. Suppose , we have two pages in a website , is " HOME " and " CONTACT " . So I am gonna show the linking process below with an example :   So , in the above example , we can see two pages...