{"id":68580,"date":"2021-08-05T22:12:39","date_gmt":"2021-08-06T02:12:39","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/c-concepts-and-syntax-77\/"},"modified":"2021-08-05T22:12:39","modified_gmt":"2021-08-06T02:12:39","slug":"c-concepts-and-syntax-77","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=68580","title":{"rendered":"C++ Concepts and Syntax #77"},"content":{"rendered":"<p>Not really for the beginners. If you had experience working with C++ in the past, then taking a look at this short-note will help to recover your knowledge in C++. <\/p>\n<p>Multiple inheritance means that one subclass can have more than one superclass. This enables the subclass to inherit properties of more than one superclass and to &#8220;merge&#8221; their properties. <\/p>\n<p>char *strp;      \/* strp is `pointer to char&#8217; *\/<\/p>\n<p> *strp = &#8216;a&#8217;;            \/* A single character *\/<\/p>\n<p>A pointer to characters can be used to point to a sequence of characters<\/p>\n<p>Class Structure:<br \/>\n class Foo {<br \/>\n    \/\/ private as default &#8230;<\/p>\n<p>  public:<br \/>\n    \/\/ what follows is public until &#8230;<\/p>\n<p>  private:<br \/>\n    \/\/ &#8230; here, where we switch back to private &#8230;<\/p>\n<p>  public:<br \/>\n    \/\/ &#8230; and back to public.<br \/>\n  };<\/p>\n<p>Struct:<br \/>\n  class Struct {<br \/>\n  public:       \/\/ Structure elements are public by default<br \/>\n    \/\/ elements, methods<br \/>\n  };<\/p>\n<p>Method definition &#8211; outside of the class<br \/>\n void Point::setX(const int val) {<br \/>\n    _x = val;<br \/>\n  }<\/p>\n<p>  void Point::setY(const int val) {<br \/>\n    _y = val;<br \/>\n  }<\/p>\n<p>Access a method:<br \/>\n apoint.setX(1);     \/\/ Initialization<\/p>\n<p>Inheritance:<br \/>\nclass Point3D : public Point {}<br \/>\nC++ has two types of inheritance: public and private. By default, classes are privately derived from each other<\/p>\n<p>You can inherit as private, protected, public. Private members always come as private in the subclass. Public members of the super class come to the subclass according\/(as) to the inheritance type<\/p>\n<p>Multiple Inheritance:<br \/>\nclass DrawableString : public Point, public DrawableObject {}<\/p>\n<p>Virtual Function in C++<br \/>\nYou can use the keyword &#8216;virtual&#8217; before a function declaration to make the function virtual. Subclasses to these class can define the function as they want. It still remains virtual in the subclasses.<br \/>\nhttp:\/\/www.codersource.net\/published\/view\/325\/virtual_functions_in.aspx<\/p>\n<p>&#8212; will update and add later<\/p>\n<p>Reference: http:\/\/gd.tuwien.ac.at\/languages\/c\/c++oop-pmueller\/tutorial.html<\/p>\n<p> From: http:\/\/sitestree.com\/?p=5240<br \/> Categories:77<br \/>Tags:<br \/> Post Data:2006-08-17 00:14:30<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Not really for the beginners. If you had experience working with C++ in the past, then taking a look at this short-note will help to recover your knowledge in C++. Multiple inheritance means that one subclass can have more than one superclass. This enables the subclass to inherit properties of more than one superclass and &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=68580\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1917],"tags":[],"class_list":["post-68580","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":65852,"url":"http:\/\/bangla.sitestree.com\/?p=65852","url_meta":{"origin":68580,"position":0},"title":"SCJP: Short Notes #Java Short Notes #SCJP","author":"Sayed","date":"July 16, 2021","format":false,"excerpt":"For the package package com.sun2;public enum Seasons {SUMMER, FALL, WINTER, SPRING} Valid import statements are:import com.sun2.Seasons; \/\/ the class import static com.sun2.Seasons.*; \/\/all enum valuesimport static com.sun2.Seasons.FALL; \/\/only one enum value An interface can extend many interfacesInterfaces can have variables, overrides and overloads An enum can have methods and can\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65838,"url":"http:\/\/bangla.sitestree.com\/?p=65838","url_meta":{"origin":68580,"position":1},"title":"SCJP: Class Declarations #Java Short Notes #SCJP","author":"Sayed","date":"July 16, 2021","format":false,"excerpt":"class declarations Start with modifiers such as public, private followed by class keyword The class name, with the initial letter capitalized The name of the class's parent (superclass), preceded by the keyword extends (if any). A class can only extend (subclass) one parent. list of interfaces implemented by the class,\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76179,"url":"http:\/\/bangla.sitestree.com\/?p=76179","url_meta":{"origin":68580,"position":2},"title":"Struct\/Record Examples in C Programming Language","author":"Sayed","date":"July 20, 2024","format":false,"excerpt":"#pragma warning(disable : 4996) #include <iostream> #include <string.h> \/\/struct struct student { char name[50]; int age; float height; }; struct student s1 = { \" Nina Chase\", 12, 1.55 }; struct student s2 = { \" Shyann Morris\", 12, 1.65 }; \/\/typedef struct typedef struct { char name[50]; int age;\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65822,"url":"http:\/\/bangla.sitestree.com\/?p=65822","url_meta":{"origin":68580,"position":3},"title":"SCJP: Language Fundamentals #Java Short Notes #SCJP","author":"Sayed","date":"July 15, 2021","format":false,"excerpt":"Class declaration and java source file. Only \"one\" top-level public class is allowed per java source file. The name of the java source file and the name of the top-level public class MUST be the same. If no public class is there in a file, after compiling separate class files\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76185,"url":"http:\/\/bangla.sitestree.com\/?p=76185","url_meta":{"origin":68580,"position":4},"title":"A Binary Tree Declaration","author":"Sayed","date":"July 20, 2024","format":false,"excerpt":"#include <stdio.h> #include <stdlib.h> \/\/ Declare a structure that holds data in a node typedef struct { int num; } NodeData; typedef struct treeNode { NodeData data; struct treeNode* left, * right; } TreeNode, *TreeNodePtr; typedef struct { TreeNodePtr root; } BinaryTree; \/\/ main method int main() { \/\/ NULL\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26483,"url":"http:\/\/bangla.sitestree.com\/?p=26483","url_meta":{"origin":68580,"position":5},"title":"Lesson 1: Short Notes on C++ #Programming #C++","author":"Author-Check- Article-or-Video","date":"April 26, 2021","format":false,"excerpt":"This short note is for those who already know C++ and want to refresh their memory. Starters can still take a look to get an overall idea. Three pillars of object-oriented development: encapsulation, inheritance, and polymorphism. C++ supports encapsulation through (user-defined) classes. Class properties and internal workings can be hidden\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/68580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=68580"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/68580\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=68580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=68580"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=68580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}