Escolar Documentos
Profissional Documentos
Cultura Documentos
Com
In case you are having issues regarding audio and video please contact at questpond@questpond.com or you can call on the phone, these training are available as recordings later , please do not disturb during training. Please Mute your mic and mobile during training. Ask your question using the Q and A tab in live meeting. Speak one at a time so that every one is benefited.
Agenda
A word about www.dotnetfunda.com Introduction What's the problem with functional programming ? OOP's Fundamentals Abstraction Encapsulation Inheritance Polymorphism Acces*s modifiers Aggregation and Composition Implementing OOPS in tiered architecture Most asked Inter*view questions in OOPS
DotNetFunda.Com
DotNetFunda right from its commencement in the year 2007 has been dedicated to render qualitative services to aid the IT community on an assortment of technological facets/confronts and has been triumphant thus far. Looking at the incredible applauds from our users and visitors across the globe on the services DotNetFunda has offered over the years; we are committed to serve even better now. We call you to help us in that direction and please participate more and more in the website; either by asking questions, answering in the Forums or writing articles, submitting interview questions and code snippets.
Wishing you all the very best and a very good Luck.
RESM
Reusability
Extensibility
Maintainability
Simplicity
Reusability Classes and object Extensibility Inheritance ,aggregation and composition Simplicity Abstraction , encapsulation and polymorphism Maintainability All the above 3 combined helps us to maintain the code better.
Reusability
Extensibility
Simplicity Maintainability
Summarizing definition
Abstraction
Encapsulation
Process of hiding inner details from the external world with that making the object interface simple.
Inheritance Polymorphism
They are used to depict parent child relationship. So we can have a class with just set and get , we can then inherit and create a new specialized class which does database operations.
We want a object to play different role depending on different situations. For instance we can class which does database operations on SQL Server and Oracle. Depending on connection string it will MORPH its role to do SQL operations or Oracle operations. Poly means many and morph means change
Addresses reusability
What is a class ?
A class is simply 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, and operations.
What is Object ?
Its an instance of a class. Class is brought live by creating objects. An object can be considered a "thing" that can perform activities. The set of activities that the object performs defines the object's behavior.
Class
Object
What is Inheritance ?
What is Inheritance ?
Addresses Extensibility
By using inheritance we can create a fresh child class which has all the qualities of parent plus some extra new Parent child qualities of himself also. relationship
By using polymorphism you can have more simplified interfaces and neat code. Addresses Simplicity
'poly' means many, 'morphism' means forms. Its a ability of object or method to take different forms as per situation. Meaning of polymorphism
This will invoke the calculation of total cost with out discount.
Both the method names are same but they act differently as per inputs This will invoke the calculation of total cost with discount.
In Static Polymorphism the method to be called is decided at compile-time only. Method Overloading is an example of Static Polymorphism. Static Polymorphism
In dynamic polymorphism a call to a overridden function is resolved during runtime. Dynamic polymorphism is acheived using inheritance and overriding.
Dynamic Polymorphism
This will invoke the calculation of total cost with out discount.
Both the method names are same but they act differently as per inputs This will invoke the calculation of total cost with discount.
Class inherited and getTotalCost overridden with new functionality Inherited Child Product class
clsProduct objProduct;
This invokes the child class code objProduct = new clsProductWithDiscount(); objProduct.getTotalCost(intQty, intPerProductCost,"INR")
Encapsulation means hiding complexity clsProduct obj = new clsProduct(); Obj. IsQuantityGreater (intQty);
Protected:- All members in current class and in derived classes can access the variables.
Friend (internal in C#):- Only members in current project have access to the elements.
Protected friend (protected internal in C#) :- All members in current project and all members in derived class can access the variables.
Abstraction is achieved through encapsulation..Abstraction solves the problem in the design side while encapsulation is the implementation.
An abstract class can contain either abstract methods or non abstract methods. Abstract members do not have any implementation in the abstract class, but the same has to be provided in its derived class.
An abstract class cannot be a sealed or a static class.
The access modifier of the abstract method should be same in both the abstract class and its derived class. If you declare an abstract method as protected, it should be protected in its derived class. Otherwise, the compiler will raise an error.
An abstract method cannot have the modifier virtual. Because an abstract method is implicitly virtual.
Define Interface and Whats the difference between abstract and interface ?
Whats a interface ?
An interface looks like a class, but has no implementation. It only contains definitions of events, indexers, methods and/or properties. The reason interfaces only provide definitions is because they are inherited by classes and structs, which must provide an implementation for each interface member defined. What are interfaces ?
They help decoupling Enforce standardization of vocabulary So what good are empty methods
The members of the interface are public with no implementation. Abstract classes can have protected parts, static methods, etc.
Abstract classes can add more functionality without destroying the child classes that were using the old version. In an interface, creation of additional functions will have an effect on its child classes, due to the necessary implementation of interface methods to classes.
Defining an abstract class with abstract members has the same effect to defining an interface.
Questions