Posts

OBJECT ORIENTED PROGRAMMING

  OBJECT ORIENTED PROGRAMMING: The principles of OOPS are: 1) Abstraction 2) Encapsulation 3) Inheritance 4) Polymorphism 1) Abstraction: Abstraction can be of two forms, data abstraction and functional abstraction . a) Data Abstraction: The representation of the data is hidden. b) Functional Abstraction:                The implementation is hidden.   C++, ' class ' provides data and functional abstraction.               Refer:  FRIEND FUNCTIONS AND FRIEND CLASS 2) Encapsulation:           a) Holding the data members and member functions as a single unit.          b) A 'class' holds its data members and member functions as a unit.             Refer: CONSTRUCTORS AND DESTRUCTORS           3) Inheritance: Inheriting...

TYPECASTING IN C++ (DYNAMIC_CAST, STATIC_CAST, REINTERPRET_CAST, CONST_CAST)

TYPE CASTING: Explicit type casting between classes have four specific casting operators:   1) dynamic_cast <new_type> (expression)           2) static_cast <new_type> (expression)           3) reinterpret_cast <new_type> (expression)           4) const_cast <new_type> (expression) 1) Dynamic Cast: a) dynamic_cast can be used only with pointers and references to objects. b) Its purpose is to ensure that the result of the type conversion is a valid complete object of the requested class. c) When dynamic_cast cannot cast a pointer because it is not a complete object of the required class, it returns a null pointer to indicate the failure. class CBase {}; class CDerived : public CBase {};   CBase b; CBase* pb; CDerived d;  CDerived* pd; pb = dynamic_cast<CBase*>(&d);    ...

INTEROPERABILITY (RCW and CCW)

Image
 Interoperability: .NET enables interoperability with unmanaged code through platform invoke services, the System.Runtime.InteropServices namespace, C++ interoperability, and COM interoperability (COM interop). a) Code that executes under the control of the runtime is called managed code.  b) Code that runs outside the runtime is called unmanaged code.  c) COM components, ActiveX interfaces, and Windows API functions are examples of unmanaged code. Runtime Callable Wrapper(RCW): a) The common language runtime exposes COM objects through a proxy called the runtime callable wrapper (RCW).  b) Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object. c) The runtime creates exactly one RCW for each COM object, regardless of the number of references that exist on that object.  d) If you create an RCW in one application domain or apartment, and then pass a reference to another ap...

INTER PROCESS COMMUNICATION (IPC)

InterProcess Communication : The Windows operating system provides mechanisms for facilitating communications and data sharing between applications. a) Applications can use IPC categorized as clients or servers .  b) A client is an application or a process that requests a service from some other application or process.  c) A server is an application or a process that responds to a client request.  d) Many applications act as both a client and a server, depending on the situation.   The following IPC mechanisms are supported by Windows: 1) Clipboard 2) COM 3) Data Copy 4) DDE 5) File Mapping 6) Mailslots 7) Pipes 8) RPC 9) Windows Sockets 1) Using the Clipboard for IPC: a) The clipboard acts as a central depository for data sharing among applications.  b) When a user performs a cut or copy operation in an application, the application puts the selected data on the clipboard in one or more standard or application-defined formats....

DATASTRUCTURES

Image
DataStructures: a) Data structures are formats used to organize, store and manage data efficiently.           e.g. stacks , queues , singly-linked lists , doubly linked lists , binary search trees , hashing and heaps .  b) Operations on data structures are searching , sorting , adding , updating and deleting .  c) A linked list is a linear data structure where the elements are not stored at the contiguous memory locations, they are stored dynamically. d) It has a collection of nodes where each node consists of two members which represents its value and a next/previous pointer which stores the address for the next/previous node. e) Stacks, Queues, Singly-linked lists, Doubly linked lists, Binary Search Trees can be implemented as linked lists. Stack: a) Stack follows LIFO(Last In First Out) principle . b) It is used in function calls. c) The functions of Stack are push(Adds an element) and pop(Extracts an element). d) It has a TOP pointer . Ex...