.

Wednesday, June 11, 2008

Object Oriented Concepts

Question: What Is OOPS ?
Answer:
OOPs is an Object Oriented Programming language,which is the extension of Procedure Oriented programming language.OOPS reduce the code of the program because of the extensive feature of Polymorphism. OOPS have many properties such as Data-Hiding,Inheritence,Data Absraction,Data Encapsulation and many moreEverything in the world is an object. The type of the object may vary. In OOPS, we get the power to create objects of our own, as & when required.


Question: what is Class ?
Answer:
A group of objects that share a common definition and that therefore share common properties, operations, and behavior. A user-defined type that is defined with the class-key 'class,' 'struct,' or 'union.' Objects of a class type consist of zero or more members and base class objects.Classes can be defined hierarchically, allowing one class to be an expansion of another, and classes can restrict access to their members.

Question: What is Constructor?
Answer:
When we create instance of class a special method of that class, called that is constructor. Similarly, when the class is destroyed, the destructor method is called. These are general terms and usually not the actual member names in most object-oriented languages. It is initialized using the keyword New, and is destroyed using the keyword Finalize.


Question: What is Abstract Class ?
Answer:
Classes that cannot be instantiated. We cannot create an object from such a class for use in our program. We can use an abstract class as a base class, creating new classes that will inherit from it. Creating an abstract class with a certain minimum required level of functionality gives us a defined starting point from which we can derive non-abstract classes. An abstract class may contain abstract methods & non-abstract methods. When a class is derived from an abstract class, the derived class must implement all the abstract methods declared in the base class. We may use accessibility modifiers in an abstract class.An abstract class can inherit from a non-abstract class. In C++, this concept is known as pure virtual method.

Question: What is ValueType?
Answer:
Value Types - Value types are primitive types. Like Int32 maps to System.Int32, double maps to System.double.All value types are stored on stack and all the value types are derived from System.ValueType. All structures and enumerated types that are derived from System.ValueType are created on stack, hence known as ValueType.In value type we create a copy of object and uses there value its not the original one.

Question: What is diff. between abstract class and an interface?
Answer:
An abstract class and Interface both have method only but not have body of method.The difference between Abstract class and An Interface is that if u call Ablstract class then u have to call all method of that particular Abstract class but if u call an Interface then it is not necessary that u call all method of that particular interface.Method OverLoading:-Return type, Parameter type, parameter and body of method number may be different.Method Overriding:- Return type, Parameter type, Parameter Number all must be same . Only body of method can change.

No comments:

.