Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /home3/techlieb/public_html/wp-content/plugins/ditty-news-ticker/includes/class-ditty-api.php on line 346

Warning: Cannot modify header information - headers already sent by (output started at /home3/techlieb/public_html/wp-content/plugins/ditty-news-ticker/includes/class-ditty-api.php:346) in /home3/techlieb/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home3/techlieb/public_html/wp-content/plugins/ditty-news-ticker/includes/class-ditty-api.php:346) in /home3/techlieb/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home3/techlieb/public_html/wp-content/plugins/ditty-news-ticker/includes/class-ditty-api.php:346) in /home3/techlieb/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home3/techlieb/public_html/wp-content/plugins/ditty-news-ticker/includes/class-ditty-api.php:346) in /home3/techlieb/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home3/techlieb/public_html/wp-content/plugins/ditty-news-ticker/includes/class-ditty-api.php:346) in /home3/techlieb/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home3/techlieb/public_html/wp-content/plugins/ditty-news-ticker/includes/class-ditty-api.php:346) in /home3/techlieb/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home3/techlieb/public_html/wp-content/plugins/ditty-news-ticker/includes/class-ditty-api.php:346) in /home3/techlieb/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home3/techlieb/public_html/wp-content/plugins/ditty-news-ticker/includes/class-ditty-api.php:346) in /home3/techlieb/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":554,"date":"2013-11-17T14:59:13","date_gmt":"2013-11-17T09:29:13","guid":{"rendered":"http:\/\/techliebe.com\/?p=554"},"modified":"2013-11-17T14:59:13","modified_gmt":"2013-11-17T09:29:13","slug":"principles-of-oop","status":"publish","type":"post","link":"https:\/\/techliebe.com\/principles-of-oop\/","title":{"rendered":"Principles of OOP"},"content":{"rendered":"

Class <\/b><\/p>\n

Class is the collection of data and functions means class encapsulates the data and function this is feature of object oriented programming.\u00a0 Objects are the variable of class one can imagine class as structure in C.\u00a0 You can created any number of object of class ( using the concept of array of objects it is very easy to create large number of objects).<\/p>\n

 <\/p>\n

Objects <\/b><\/p>\n

Objects are basic run time entity in object oriented system. They represent a place, a bank account, or person.\u00a0 Objects are the instance of class or a variable of user defined data types. When you declare a class there is no memory for data, after creation of class memory is allocated for data and this process is called as instantiation. Each object has its own copy of instance variable of its class. It means any changes to the variable of one object have no effect on another variable.<\/p>\n

 <\/p>\n

\"Object<\/a><\/p>\n

Data Abstraction <\/b><\/p>\n

Data abstraction refers to the process of hiding complex and unnecessary information. Classes use the concept of data abstraction and are defined as a list of abstract attributes such as size, weight and cost. Real time example of data abstraction would be ATM machine user withdrawals cash without knowing it internal working, another example would be index of a book.<\/p>\n

 <\/p>\n

Data Encapsulation<\/b><\/p>\n

Data encapsulation means encapsulating data and member function inside a single unit and this unit is nothing but a CLASS.\u00a0 Data encapsulated inside this class is only accessible to the member function of class<\/p>\n

Inheritance<\/b><\/p>\n

Inheritance is striking feature of OOP. Inheritance means one class inherits the properties of another class. Using Inheritance re-usability can be achieved.<\/p>\n

Polymorphism<\/b><\/p>\n

Polymorphism is the ability to take more than one for.\u00a0 Polymorphism means\u00a0 function behaves according to the instance for example consider the operation of finding area if two arguments are passed to function it will return area of rectangle, if 3 arguments are passed it will return area of a cube.<\/p>\n

Inline Function<\/b><\/p>\n

Inline function is similar to macro. When normal function is called control is transferred to the function and this process takes lots of extra time in executing series of instructions to avoid this concept of inline function have been introduced. When inline function is called code associated with inline function is substituted. One biggest disadvantage of inline function is that wastage of memory.<\/p>\n

Friend Function<\/b><\/p>\n

As explained earlier that only member function can access private data of class but there could be situation when we need two classes to share a function. In such situation we can use a common function \u201cFRIEND FUNCTION\u201d. Friend function has access to both classes.<\/p>\n

 <\/p>\n

\"OOP<\/a><\/p>\n

 <\/p>\n

Syntax for friend function is as follows:<\/p>\n

Class Student<\/i><\/p>\n

{<\/i><\/p>\n

Private:<\/i><\/p>\n

int mark1,mark2<\/i><\/p>\n

Public:<\/i><\/p>\n

int roll<\/i><\/p>\n

void getdata()<\/i><\/p>\n

{<\/i><\/p>\n

Mark1=50;<\/i><\/p>\n

Mark2=60;<\/i><\/p>\n

}<\/i><\/p>\n

Friend void myfriend(void)<\/i><\/p>\n

};<\/i><\/p>\n

Constructor<\/b><\/p>\n

Constructor is a function it job is to do automatic initialization of data upon creation of object. Constructor neither takes any argument nor returns any value. Class name and constructor name is always same.<\/p>\n","protected":false},"excerpt":{"rendered":"

Class Class is the collection of data and functions means class encapsulates the data and function this is feature of object oriented programming.  Objects are the variable of class one can imagine class as structure in C.  You can created any number of object of class ( using the concept of array of objects it […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[55],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/posts\/554"}],"collection":[{"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/comments?post=554"}],"version-history":[{"count":1,"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/posts\/554\/revisions"}],"predecessor-version":[{"id":557,"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/posts\/554\/revisions\/557"}],"wp:attachment":[{"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/media?parent=554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/categories?post=554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techliebe.com\/wp-json\/wp\/v2\/tags?post=554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}