Page 2 :
OOPs Concept, Object-Oriented Programming (OOP) is one of the popular methodologies in software development., , It stands for Object Oriented Programming. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C, Pascal, etc.), , Everything in OOP is grouped as self sustainable "objects”., , In order to clearly understand the object orientation, let’s take your “hand” as an example. The “hand” is a class.
Page 3 :
OOPs Concept-Object, Object:-, An object is the main concept involved in this methodology., , An object is the representation of a real-world entity or concept., , An object can be considered a "thing" that can perform a set of related activities. , , The set of activities that the object performs defines the object's behavior.
Page 4 :
OOPs Concept, Constructor:-, “C# supports a special type of method called constructor ,that enables an objects to initialize itself when it is created.”, Constructor is used to initialize an object (instance) of a class., Constructor is a like a method without any return type., Constructor has same name as class name., Constructor follows the access scope (Can be private, protected, public, Internal and external)., Constructor can be overloaded.
Page 5 :
OOPs Concept, Constructor:- Type, Default Constructs :- Constructor with no parameters is known as default constructor., Parameter Constructs :- Constructor with parameters is known as parameterized constructor., Static Constructor :-a static constructor is declare by prefixing a static keyword to the constructor definition .it can not have any parameters., Private Constructor :- Private access modifier ., , Copy Constructor :- A copy Constructor creates an objects buy copying variables from another object.
Page 6 :
OOPs Concept-Class, What is a Class?, A class is simply a representation of a type of object., It is the blueprint/ plan/ template that describe the details of an object., A class is the blueprint from which the individual objects are created., Class is composed of three things:-, A name., Attributes., operations.
Page 7 :
OOPs Concept-Class, syntax:, , [access-modifiers] class identifier [:base-class], {, class body, }, , Example: , public class Time , {, //all class code goes here, }
Page 8 :
OOPs Concept-Class, The General Form of a Class , A class is created by use of the keyword class. , class classname , { // declare instance variables access type var1; access type var2; // ... access type varN; // declare methods access ret-type method1(parameters) , { // body of method } access ret-type method2(parameters) , { // body of method } // ... access ret-type methodN(parameters), { // body of method }}
Page 9 :
OOPs Concept-Class, Class Modifiers -There are seven different - optional - class modifiers. Four of these - 'public', 'internal', 'protected' and 'private' - are used to specify the access levels of the types defined by the classes., , Access specifiers specify the access rules for the members as well as the class itself., If not mentioned then the default access specifier for a class type is internal., Default access for the members is private., , To access the class members, you will use the dot (.) operator., , The dot operator links the name of an object with the name of a member.
Page 12 :
OOPs Concept-Class, Class Members, The different types defined by the Common Type System (CTS). These types are supported as members of C# classes and include the following:, Fields, Methods, Events, Indexers, Properties, Constants, Operators
Page 14 :
Pillar of OOPs-Encapsulation., Encapsulation:-, Encapsulation provides the ability to hide the internal details of an object from its users., The out side user may not be able to change the state of an object directly., The state of an object may be altered indirectly using what are known accessor., , In C# ,encapsulation is implemented using the access modifier keywords., public , private, protected
Page 15 :
Pillar of OOPs-Abstraction, Abstraction:-, Abstraction is the process of recognizing and focusing on important characteristics of a situation or object and leaving/filtering out the un-wanted characteristics of that object., , A doctor sees (abstracts) the person as patient. The doctor is interested in name, height, weight, age, blood group, previous or existing diseases etc of a person., Abstraction is the process of exhibiting only the essential characteristics of an object depending on programmers view. It is complement to encapsulation., , Data abstraction is the process of representing essential details not including internal details. , Example index of the book
Page 17 :
Pillar of OOPs- Inheritance, Basic Terms, Base class The original class., Parent class/SuperClass Another name for a base class., Derived class A new class, created by inheriting from a base class., Child class/Sub Class Another name for a derived class., Single inheritance A derived class created from only one base class. C# supports only single inheritance. , Multiple inheritance A derived class created from two or more base classes. C# does not support multiple inheritance.
Page 18 :
Pillar of OOPs- Inheritance, Inheritance:-, The mechanism of designing or designing or constructing one class from another is called INHERITANCE., , Inheritance is one of the most important features of OOP. Any class may inherit from another., , Which means that it will have all the members of the class from which it inherits., , Inheritance is especially important in that it give the Smalltalk language reusability and extensibility.
Page 19 :
Pillar of OOPs- Inheritance, Inheritance:-, In OOP terminology, the class being inherited from (derived from) is the parent class (also known as the base class).
Page 20 :
Pillar of OOPs- Inheritance, Inheritance types:-, , Single Inheritance., , Multiple Inheritance. (not in C#), , Hybrid Inheritance., , Multilevel Inheritance. , , Hierarchical Inheritance.
Page 21 :
Pillar of OOPs- Inheritance, (1) Simple / Single., (2) Multilevel., (3) Hierarchical., (4) Multiple., (5) Hybrid.
Page 22 :
Pillar of OOPs- Inheritance, Single Inheritance:- when a single class is being inherited by a class, it is called single or simple inheritance., When a derived class has only one base class its called a single inheritance, Syntax:-, [Access Modifier] class ClassName : base classname, { class member ; , }, Public class A , {, int x,y;, }, Public class B : A , { , int z;, }
Page 23 :
Pillar of OOPs- Multi level Inheritance, Multilevel Inheritance:- , When you define more than two levels of inheritance (in the form of a chain of classes),, It would be generally referred to as multi-level inheritance. , In the case of multi-level inheritance, all the members of all super classes would be automatically available within the sub class., Class base_class_name1, {, // List of members, }, <access specifier> Class 2 : base_class_name1, {, // List of members, }, <access specifier> class3 : derived_base_name2, {, // List of members, }
Page 24 :
Sealed class, Sealed class could not be inherited., Inheritance is restricted using sealed keyword in c sharp., Structure are implicitly sealed therefore they cannot be inherited
Page 25 :
sealed class SinglyList, {, public virtual double Add(), {, //code to add a record in the linked list, }, }, Sealed class, Sealed class could not be inherited., sealed class StringSinglyList:SinglyList, {, public override double Add(), {, //code to add a record in the string linked list, }, }
Page 27 :
Polymorphism (Late Binding), Ability of different objects to responds to the same message in different way is called Polymorphism., When a message can be processed in different ways is called polymorphism. Polymorphism means many forms.
Page 28 :
Virtual and Override, Polymorphism is achieved using virtual functions and inheritance., , Virtual keyword are used to define a method in base class., , Override keyword used in derived class is to extend base class behavior., , In method overriding ,methods have same name ,same signature ,same return type but in different scope ., , In C#, keyword virtual and override is use to define method overriding.
Page 30 :
Interface : Multiple Inheritance, An Interface can contain one or more methods,properties,indexers and events but none of them are implemented in the interface itself., , It is the responsibility of the class that implements the interface to define the code for the implementation of these members. , , Classes and structs can inherit from interfaces similar to how classes can inherit a base class or struct., , A class or struct can inherit more than one interface., , When a class or struct inherits an interface, it inherits member definitions but not implementations.
Page 31 :
Interface, An interface is a collection of public instance (that is, no static) methods and properties that are grouped together to encapsulate specific functionality. , After an interface has been defined, you can implement it in a class., Interfaces cannot exist on their own. You can’t ‘‘instantiate an interface’’ as you can a class., , Interfaces are declared by using the interface keyword., , Syntax, interface name , {, ret-type method-name1(param-list);, ret-type method-name2(param-list);, // .............., ret-type method-nameN(param-list);, }
Page 32 :
Interface, An interface defines a Contract.
Page 35 :
Execution of .NET Application
Page 36 :
JIT Compiler, .NET Source code compiled twice before execution., Source code (C# or VB.Net ) is compiled in to MSIL code with the help of language specific compiler. E.g. CSC compiler for c # and VBC compiler for VB.Net., , C # compiler compiles source code in to MSIL code., , MSIL code stored in file with extension either .dll or.exe .it is a logical unit of deployment called Assembly., , The MSIL code is then compiled by JUST –IN –TIME (JIT) compiler(part of CLR) into native executable code., , This executable code is then processed by machine processor.
Page 37 :
JIT Compiler, Assembly Loader:, Assembly Loader is one of the components of CLR .It first locates the assembly which contains Main() and then load it in to memory., , It also locates and load other classes from FCL which are used in the code.
Page 38 :
JIT Compiler, Code Verifier:, It is a core component of CLR., , It verifies MSIL code to check permissions against trust policies defined with .NET environment., , This concept is called Code Access Security., , With the help of code verifier and security configuration .NET Environment can prevent execution of unsafe code.
Page 39 :
JIT Compiler, The term just in time means “Take Action as soon as request come”., , Just-in-time (JIT) is a term used to describe an action such as compilation or object activation only at the time when it becomes necessary., , JIT compilation is mainly designed for high-speed code execution and support for multiple platforms., , JIT compilers facilitate portability to multiple operating systems and hardware platforms. Languages such as Smalltalk, Pascal Java and C# support JIT compilation
Page 40 :
JIT Compiler, When a method is invoked ,the JIT compiler analyzes the MSIL code and produce high efficient machine code., , JIT compilers take code that is already 'partially compiled' in an intermediate form such as Microsoft's IL , and put it into a machine specific form as its running., , In other words, it finishes the compiling just-in-time for it to be run.
Page 41 :
JIT Compiler, There are three types of JIT compiler :-, Standard JIT : used in development of applications., , Pre-JIT: Compiles the entire source code during compilation and is used at the time of deployment., , Econo-JIT: Compiles methods that are called during run time. It is also used in Mobile applications.