Important Questioner

OOPS Concepts

Now, let us discuss some of the main features of Object Oriented Programming which you will be using in C++(technically).
  1. Objects
  2. Classes
  3. Abstraction
  4. Encapsulation
  5. Inheritance
  6. Overloading
  7. Exception Handling
---------------------------------------------------------------------------------------------------------------------------------

Objects

Objects are the basic unit of OOP. They are instances of class, which have data members and uses various member functions to perform tasks.

Class

It is similar to structures in C language. Class can also be defined as user defined data type but it also contains functions in it. So, class is basically a blueprint for object. It declare & defines what data variables the object will have and what operations can be performed on the class's object.

Abstraction


Abstraction refers to showing only the essential features of the application and hiding the details. In C++, classes provide methods to the outside world to access & use the data variables, but the variables are hidden from direct access. This can be done access specifiers.

Encapsulation


It can also be said data binding. Encapsulation is all about binding the data variables and functions together in class.

Inheritance


Inheritance is a way to reuse once written code again and again. The class which is inherited is called base calls & the class which inherits is called derived class. So when, a derived class inherits a base class, the derived class can use all the functions which are defined in base class, hence making code reusable.

Polymorphism


It is a feature, which lets us create functions with same name but different arguments, which will perform differently. That is function with same name, functioning in different way. Or, it also allows us to redefine a function to provide its new definition. You will learn how to do this in details soon in coming lessons.

Exception Handling


Exception handling is a feature of OOP, to handle unresolved exceptions or errors produced at runtime.

======================================================================

Over Loading/Over Riding


Overloading occurs when two or more methods in one class have the samemethod name but different parameters. Overriding means having two methodswith the same method name and parameters

Functions to be overloaded must have the same name.
All functions must have different arguments( either a different number of parameters or different type of parameters ).
Let's see an example.

#include <iostream>

using namespace std;

class Rectangle
{
public:
void printArea(int x, int y)
{
cout << x * y << endl;
}
void printArea(int x)
{
cout << x * x << endl;
}
void printArea(int x, double y)
{
cout << x * y << endl;
}
void printArea(double x)
{
cout << x * x << endl;
}
};

int main()
{
Rectangle rt;
rt.printArea(2,4);
rt.printArea(2,5.1);
rt.printArea(10);
rt.printArea(2.3);
return 0;
}
------------------------------------------------------------------------------------------------------------------------

C++ Overloading (Operator and Function) ... C++ allows you to specify more than one definition for a function name or an operator in the same scope, which is called function overloading and operator overloading respectively.


// CPP program to illustrate
// Function Overriding
#include<iostream>
using namespace std;
 
class BaseClass
{
public:
    virtual void Display()
    {
        cout << "\nThis is Display() method"
                " of BaseClass";
    }
    void Show()
    {
        cout << "\nThis is Show() method "
               "of BaseClass";
    }
};
 
class DerivedClass : public BaseClass
{
public:
    // Overriding method - new working of
    // base class's display method
    void Display()
    {
        cout << "\nThis is Display() method"
               " of DerivedClass";
    }
};
 
// Driver code
int main()
{
    DerivedClass dr;
    BaseClass &bs = dr;
    bs.Display();
    dr.Show();
}
Output:
This is Display() method of DerivedClass
This is Show() method of BaseClass

=======================================================================
class Thing {
public:
    Thing();                        // default constructor
    Thing(const Thing&);            // copy c'tor
    Thing& operator=(const Thing&); // copy-assign
    ~Thing();                       // d'tor
    // C++11:
    Thing(Thing&&);                 // move c'tor
    Thing& operator=(Thing&&);      // move-assign
};
=======================================================================

Copy Constructor

In the C++ programming language, a copy constructor is a special constructor for creating a new object as a copy of an existing object. Copy constructors are the standard way of copying objects in C++, as opposed to cloning, and have C++-specific nuances.

===================================================================Multi Threading

Multithreading is a specialized form of multitasking and a multitasking is the feature that allows your computer to run two or more programs concurrently. In general, there are two types of multitasking: process-based and thread-based.
Process-based multitasking handles the concurrent execution of programs. Thread-based multitasking deals with the concurrent execution of pieces of the same program.
A multithreaded program contains two or more parts that can run concurrently. Each part of such a program is called a thread, and each thread defines a separate path of execution.
C++ does not contain any built-in support for multithreaded applications. Instead, it relies entirely upon the operating system to provide this feature.
This tutorial assumes that you are working on Linux OS and we are going to write multi-threaded C++ program using POSIX. POSIX Threads, or Pthreads provides API which are available on many Unix-like POSIX systems such as FreeBSD, NetBSD, GNU/Linux, Mac OS X and Solaris.

===================================================================

Critical Section


Critical Section is a code segment that accesses shared variables and has to be executed as an atomic action. It means that in a group of cooperating processes, at a given point of time, only one process must be executing its critical section.
===================================================================

Mutex

The mutex class is a synchronization primitive that can be used to protect shared data from being simultaneously accessed by multiple threads. mutex offers exclusive, non-recursive ownership semantics: A calling thread owns a mutex from the time that it successfully calls either lock or try_lock until it calls unlock 
===================================================================

List

Lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence, and iteration in both directions.
===================================================================

Map

Maps are associative containers that store elements formed by a combination of a key value and a mapped value, following a specific order.

In a map, the key values are generally used to sort and uniquely identify the elements, while the mapped values store the content associated to this key. The types of key and mapped value may differ, and are grouped together in member type value_type, which is a pair type combining both:

 
typedef pair<const Key, T> value_type;

===================================================================

Vector

Vectors are sequence containers representing arrays that can change in size.

Just like arrays, vectors use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to its elements, and just as efficiently as in arrays. But unlike arrays, their size can change dynamically, with their storage being handled automatically by the container.
===================================================================

STL

STL Description:

The Standard Template Libraries (STL's) are a set of C++ template classes to provide common programming data structures and functions such as doubly linked lists (list), paired arrays (map), expandable arrays (vector), large string storage and manipulation (rope), etc. The STL library is available from the STL home page. This is also your best detailed reference for all of the STL class functions available.

Also see our C++ Templates tutorial

STL can be categorized into the following groupings:


Container classes:

Sequences:

vector: 

(this tutorial) Dynamic array of variables, struct or objects. Insert data at the end. 

deque:

 Array which supports insertion/removal of elements at beginning or end of array

list:

 (this tutorial) Linked list of variables, struct or objects. Insert/remove anywhere.

Associative Containers:

set

 (duplicate data not allowed in set), multiset (duplication allowed): Collection of ordered data in a balanced binary tree structure. Fast search.

map 

(unique keys), multimap (duplicate keys allowed): Associative key-value pair held in balanced binary tree structure.

Container adapters:

stack LIFO
queue FIFO
priority_queue returns element with highest priority.

String:

string: 

Character strings and manipulation

rope: 

String storage and manipulation

bitset: Contains a more intuitive method of storing and manipulating bits.
Operations/Utilities:

iterator:

 (examples in this tutorial) STL class to represent position in an STL container. An iterator is declared to be associated with a single container class type.

algorithm: 

Routines to find, count, sort, search, ... elements in container classes

auto_ptr:

 Class to manage memory pointers and avoid memory leaks.
===================================================================
Design Patterns
===================================================================

SDI, MDI

Main Difference

MDI and SDI are interface designs for handling documents within a single application. MDI stands for “Multiple Document Interface” while SDI stands for “Single Document Interface”. Both are different from each other in many aspects. One document per window is enforced in SDI while child windows per document are allowed in MDI. SDI contains one window only at a time but MDI contain multiple document at a time appeared as child window. MDI is a container control while SDI is not container control. MDI supports many interfaces means we can handle many applications at a time according to user’s requirement. But SDI supports one interface means you can handle only one application at a time.

===================================================================Model Dialog Box,modeless Dialog Box

Dialog boxes are either modal or modeless. A modal dialog box must be closed (hidden or unloaded) before you can continue working with the rest of the application. For example, a dialog box is modal if it requires you to click OK or Cancel before you can switch to another form or dialog box.

===================================================================Polymorphism in C++

The word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form.
Real life example of polymorphism, a person at a same time can have different characteristic. Like a man at a same time is a father, a husband, a employee. So a same person posses have different behavior in different situations. This is called polymorphism.
Polymorphism is considered as one of the important features of Object Oriented Programming.
In C++ polymorphism is mainly divided into two types:
Compile time Polymorphism
Runtime Polymorphism

Compile time polymorphism: 


This type of polymorphism is achieved by function overloading or operator overloading.

Function Overloading: 


When there are multiple functions with same name but different parameters then these functions are said to be overloaded. Functions can be overloaded by change in number of arguments or/and change in type of arguments.
Rules of Function Overloading
// C++ program for function overloading

#include <bits/stdc++.h>
using namespace std;
class Geeks
{
    public:
   
    // function with 1 int parameter
    void func(int x)
    {
        cout << "value of x is " << x << endl;
    }
   
    // function with same name but 1 double parameter
    void func(double x)
    {
        cout << "value of x is " << x << endl;
    }
   
    // function with same name and 2 int parameters
    void func(int x, int y)
    {
        cout << "value of x and y is " << x << ", " << y << endl;
    }
};

int main() {
   
    Geeks obj1;
   
    // Which function is called will depend on the parameters passed
    // The first 'func' is called
    obj1.func(7);
   
    // The second 'func' is called
    obj1.func(9.132);
   
    // The third 'func' is called
    obj1.func(85,64);
    return 0;
}
Run on IDE
Output:
value of x is 7
value of x is 9.132
value of x and y is 85, 64
In the above example, a single function named func acts differently in three different situations which is the property of polymorphism.

Operator Overloading:

 C++ also provide option to overload operators. For example, we can make the operator (‘+’) for string class to concatenate two strings. We know that this is the addition operator whose task is to add to operands. So a single operator ‘+’ when placed between integer operands , adds them and when placed between string operands, concatenates them.
Example:
// CPP program to illustrate
// Operator Overloading
#include<iostream>
using namespace std;
 
class Complex {
private:
    int real, imag;
public:
    Complex(int r = 0, int i =0)  {real = r;   imag = i;}
     
    // This is automatically called when '+' is used with
    // between two Complex objects
    Complex operator + (Complex const &obj) {
         Complex res;
         res.real = real + obj.real;
         res.imag = imag + obj.imag;
         return res;
    }
    void print() { cout << real << " + i" << imag << endl; }
};
 
int main()
{
    Complex c1(10, 5), c2(2, 4);
    Complex c3 = c1 + c2; // An example call to "operator+"
    c3.print();
}
Run on IDE
Output:
12 + i9
In the above example the operator ‘+’ is overloaded. The operator ‘+’ is an addition operator and can add two numbers(integers or floating point) but here the operator is made to perform addition of two imaginary or complex numbers. To learn operator overloading in details visit this link.

Runtime polymorphism:


 This type of polymorphism is achieved by Function Overriding.
Function overriding on the other hand occurs when a derived class has a definition for one of the member functions of the base class. That base function is said to be overridden.
// C++ program for function overriding

#include <bits/stdc++.h>
using namespace std;

// Base class
class Parent
{
    public:
    void print()
    {
        cout << "The Parent print function was called" << endl;
    }
};

// Derived class
class Child : public Parent
{
    public:
   
    // definition of a member function already present in Parent
    void print()
    {
        cout << "The child print function was called" << endl;
    }
   
};

//main function
int main()
{
    //object of parent class
    Parent obj1;
   
    //object of child class
    Child obj2 = Child();
   
   
    // obj1 will call the print function in Parent
    obj1.print();
   
    // obj2 will override the print function in Parent
    // and call the print function in Child
    obj2.print();
    return 0;
}
Run on IDE
Output:
The Parent print function was called
The child print function was called
===================================================================

How does compiler do this magic of late resolution?

Compiler maintains two things to this magic:
virtualFuns
vtable: A table of function pointers. It is maintained per class.
vptr: A pointer to vtable. It is maintained per object (See this for an example).






=====================================================================
V-Table
===================================================================

Vertual Functions


virtual function is a member function that you expect to be redefined in derived classes. When you refer to a derived class object using a pointer or a reference to the base class, you can call a virtual function for that object and execute the derived class's version of the function
===================================================================
VPTR
===================================================================
Projects worked on
===================================================================

Source Controls 

===================================================================
SDLC


1. Waterfall Model

Waterfall is the oldest and most straightforward of the structured SDLC methodologies — finish one phase, then move on to the next. No going back. Each stage relies on information from the previous stage and has its own project plan. Waterfall is easy to understand and simple to manage. But early delays can throw off the entire project timeline. And since there is little room for revisions once a stage is completed, problems can’t be fixed until you get to the maintenance stage. This model doesn’t work well if flexibility is needed or if the project is long term and ongoing.

2. V-Shaped Model

Also known as the Verification and Validation model, the V-shaped model grew out of Waterfall and is characterized by a corresponding testing phase for each development stage. Like Waterfall, each stage begins only after the previous one has ended. This model is useful when there are no unknown requirements, as it’s still difficult to go back and make changes.

3. Iterative Model

The Iterative model is repetition incarnate. Instead of starting with fully known requirements, you implement a set of software requirements, then test, evaluate and pinpoint further requirements. A new version of the software is produced with each phase, or iteration. Rinse and repeat until the complete system is ready.
One advantage over other SDLC methodologies: This model gives you a working version early in the process and makes it less expensive to implement changes. One disadvantage: Resources can quickly be eaten up by repeating the process again and again.

4. Spiral Model

One of the most flexible SDLC methodologies, the Spiral model takes a cue from the Iterative model and its repetition; the project passes through four phases over and over in a “spiral” until completed, allowing for multiple rounds of refinement. This model allows for the building of a highly customized product, and user feedback can be incorporated from early on in the project. But the risk you run is creating a never-ending spiral for a project that goes on and on.

5. Big Bang Model

A bit of an anomaly among SDLC methodologies, the Big Bang model follows no specific process, and very little time is spent on planning. The majority of resources are thrown toward development, and even the client may not have a solid grasp of the requirements. This is one of the SDLC methodologies typically used for small projects with only one or two software engineers.
Learn more about the pay range for software engineers in your area.
Big Bang is not recommended for large or complex projects, as it’s a high-risk model; if the requirements are misunderstood in the beginning, you could get to the end and realize the project may have to be started all over again.

6. Agile Model

By breaking the product into cycles, the Agile model quickly delivers a working product and isconsidered a very realistic development approach. The model produces ongoing releases, each with small, incremental changes from the previous release. At each iteration, the product is tested.
This model emphasizes interaction, as the customers, developers and testers work together throughout the project. But since this model depends heavily on customer interaction, the project can head the wrong way if the customer is not clear on the direction he or she wants to go.

===================================================================


Characteristics of OOP
===================================================================
Give an example for Abstraction?
===================================================================
What is a macro?
===================================================================
Describe about default/const parameter?

In C++ programming, you can provide default values for function parameters. The idea behind default argument is simple. If a function is called by passing argument/s, those arguments are used by the function. But if the argument/s are not passed while invoking a function then, the default values are used.




=====================================================================
Polymorphism concept?
===================================================================
What is virtual table and v pointer?
===================================================================
Call by value and call be reference?
===================================================================
Function overloading?
===================================================================
In data structures linked list, stack, queues and searching algorithms



Searching Algorithms :
===================================================================

Comments

noahemma said…
Get Tips for FREE UNLIMITED OST TO PST CONVERTER - https://free-unlimited-ost-to-pst-converter.blogspot.com/

ost to pst converter software
devidcharles said…
7 zip Password Cracker Stella statistics recovery software program dispose of your 7 zip Password this software Crack 7 zip record Password any types with out troubles take away your 7 zip file Password via three alternatives dictionary attack , brute force attack , mask assault this software program software Crack your 7 zip report Password with out statistics injure of your 7 zip record. You could get higher your 7 zip document Password by means of free Demo model of seven zip document Password recovery.

how to recover 7zip password