{"id":1944,"date":"2022-04-07T06:17:00","date_gmt":"2022-04-07T06:17:00","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=1944"},"modified":"2022-04-07T06:17:00","modified_gmt":"2022-04-07T06:17:00","slug":"object-oriented-programming","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/04\/07\/object-oriented-programming\/","title":{"rendered":"Object-Oriented Programming"},"content":{"rendered":"\n<p>Dart is an object-oriented programming language, which means every value in a Dart is an object. A number is also an object in Dart language. Dart programming supports the concept of OOPs features like objects, classes, interfaces, etc.<\/p>\n\n\n\n<p><strong>Object:<\/strong>&nbsp;An object is an entity, which has state and behavior. It can be physical or logical. In Dart, every value is an object, even primitive values like text and number. Dart can also allow you to build your custom object to express more complex relations between data.<\/p>\n\n\n\n<p><strong>Class:<\/strong>&nbsp;A class is a collection of objects. It means the objects are created with the help of classes because every object needs a blueprint based on which you can create an individual object. A class definition includes the following things:<\/p>\n\n\n\n<ul><li>Fields<\/li><li>Methods<\/li><li>Constructor<\/li><li>Getters and setters<\/li><\/ul>\n\n\n\n<p>Let us see an example, which helps you to understand the OOPs concept easily.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Mobile {  \n  \/\/ Property Declaration  \n  String color, brandName, modelName;  \n    \n  \/\/ Method Creation  \n  String calling() {  \n    return \"Mobile can do call to everyone.\";  \n  }  \n  String musicPlay() {  \n    return \"Mobile can play all types of Music.\";  \n  }  \n  String clickPicture() {  \n    return \"Mobile can take pictures.\";  \n  }  \n}  \n  \nvoid main() {  \n  \/\/ Object Creation  \n  var myMob = new Mobile();   \n    \n  \/\/ Accessing Class's Property  \n  myMob.color = \"Black\";   \n  myMob.brandName = \"Apple Inc.\";  \n  myMob.modelName = \"iPhone 11 Pro\";  \n    \n  \/\/Display Output  \n  print(myMob.color);  \n  print(myMob.modelName);  \n  print(myMob.brandName);  \n  print(myMob.calling());  \n  print(myMob.musicPlay());  \n  print(myMob.clickPicture());  \n}  <\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/www.javatpoint.com\/flutter-dart-programming#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-dart-programming#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/flutter-dart-programming#\"><\/a><\/p>\n\n\n\n<p>In the above example, we define a class&nbsp;<strong>Mobile<\/strong>, which has three variables of string type and three functions or methods. Then, we create a&nbsp;<strong>main<\/strong>&nbsp;function which Dart will execute first when your app starts. Inside the main, we create an&nbsp;<strong>object<\/strong>&nbsp;to access the class&#8217;s properties. Finally, we print the output.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dart is an object-oriented programming language, which means every value in a Dart is an object. A number is also an object in Dart language. Dart programming supports the concept of OOPs features like objects, classes, interfaces, etc. Object:&nbsp;An object is an entity, which has state and behavior. It can be physical or logical. In [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[659],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1944"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=1944"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/1944\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=1944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=1944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=1944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}