🧩polymorphism -3specifier override to indicate intention to override Assume that you want override the Fish::Swim in Derived class but with a slightly different signature - one using const…2024-06-19Coding
🧩polymorphism -2using virtual inheritance to solve the diamond problem how many instances of Base class are instantiated for one instance of secDerived which is derived from Derived class when…2024-06-18Coding
🧩polymorphism -1basics of polymorphism e.g. invoking methods using an instance of Base class which belongs to Derived class. demolist11_1…2024-06-17Coding
🧩implementing Inheritance - Q&AQ&A Q : class D2 inherits from class D1, which inherits from class Base. To keep D2 from accessing the public members in Base, what access specifier would you use and where…2024-06-16Coding
🧩Inheritanceprivate inheritance private is used in the line where the derived class declares its inheritance from a base class. syntax 123456789class Base{ //...base class members and…2024-06-15Coding
🧩basics of inheritance - part 2invoking method of a base class in a derived class Typically, if your specialized implementations in derived class need to reuse the base class's generic implementation, you can…2024-06-14Coding
🧩basics of inheritance - part 1C++ syntax of derivation 1234class base{ //...base class members} 1234class Derived: access-specifier Base{ //...derived class members} the base class is also called the super…2024-06-13Coding
🧩union & struct & aggregate & constexprusing aggregate initialization on classes and structs aggregate initialization syntax 1Type objectName = {argument1,...,argumentN} alternatively 1Type objecname…2024-06-12Coding
🧩union and structsizeof() a char* pointer's size is fixed at 4 bytes (on 32-bit system, and double it on 64-bit) and is independent of the volume of data being pointed to. declaring a friend of…2024-06-11Coding
🧩constructor -3move constructor 123456789class MyString{ // pick implementation from Listing 9.9};MyString Copy(MyString& source) // function{ MyString copyForReturn(source.GetString())…2024-06-10Coding