OOP’s Interview Question and Answer Video series : OOP’s Interview Question and Answer Video series By http://www.questpond.com
Mail us at questpond@questpond.com
What’s the problem with Functional Programming ? : What’s the problem with Functional Programming ? RESM
Slide 3 : Different copies of same code in both the UI – Increase in redundant code
Slide 4 : New Functions created rather than extending Extensibility and simplicity Issues
Slide 5 :
How does OOP address the problem ? : How does OOP address the problem ?
Slide 7 : Abstraction
Encapsulation
Polymorphism
Inheritance
Can we define OOP’s ? : Can we define OOP’s ?
What are the different properties in OOPS ? : What are the different properties in OOPS ?
What are classes and objects ? : What are classes and objects ?
Slide 11 : Class Object Class used as object
Slide 12 : Same class reused in both UI’s by creating objects
What is Inheritance ? : What is Inheritance ?
Slide 14 : New Functions created rather than extending Problems Extensibility and simplicity Issues
Slide 15 : Colon represent inheritance clsProduct class is extended and clsProductDicount class is created using inheritance.
What is Polymorphism , overloading , overriding and virtual ? : What is Polymorphism , overloading , overriding and virtual ?
Slide 17 : Both the method names are same but they act differently as per inputs This will invoke the calculation of total cost with out discount. This will invoke the calculation of total cost with discount.
Two types of polymorphism : Two types of polymorphism
Slide 19 : Both the method names are same but they act differently as per inputs This will invoke the calculation of total cost with out discount. This will invoke the calculation of total cost with discount. Static polymorphism is achieved by using method overloading
Slide 20 : Parent Product class Inherited Child Product class Virtual keyword necessary to override the method Override keyword necessary to define new implementation Class inherited and ‘getTotalCost’ overridden
with new functionality
Slide 21 : clsProduct objProduct; objProduct = new clsProduct();objProduct.getTotalCost(intQty, intPerProductCost,"INR") objProduct = new clsProductWithDiscount();objProduct.getTotalCost(intQty, intPerProductCost,"INR") This invokes the parent class code This invokes the child class code Dynamic polymorphism is achieved by using overriding
Can you explain encapsulation and abstraction ? : Can you explain encapsulation and abstraction ? clsProduct obj = new clsProduct();
obj.CheckProduct(intPerProductCost);
obj.CheckQty(intQty);
int totalCost = obj.getTotalCost(10,100); clsProduct obj = new clsProduct();
obj.PerProductCost = intPerProductCost;
obj.Quantity = intQty; Encapsulation means hiding complexity Extra exposed functionalities. Complication encapsulated
Slide 23 :
Abstraction, difference between abstraction and encapsulation? : Abstraction, difference between abstraction and encapsulation?
What’s a abstract class ? : What’s a abstract class ? Abstract classes are one of the essential behaviors provided by .NET. Commonly, you would like to make classes that only represent base classes, and don’t want anyone to create objects of these class types. You can make use of abstract classes to implement such functionality in C# using the modifier 'abstract'. An abstract class means that, no object of this class can be instantiated, but can make derivations of this. 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 class. I.e. the following declaration is incorrect.
Slide 26 :
What’s a interface ? : What’s a interface ?
Slide 28 :
What’s a difference between interfaces and abstract classes ? : What’s a difference between interfaces and abstract classes ?
Slide 30 : What’s the difference between shadowing and overriding ?
How can we prevent the class to inherit further ? : How can we prevent the class to inherit further ?
What is difference between aggregation and composition ? : What is difference between aggregation and composition ?
What’s the difference between classes and structures ? : What’s the difference between classes and structures ?
What is the use of Static keyword ? : What is the use of Static keyword ?