OOPS
Class :
A class is a user-defined data type which holds both the data and functions to operate on that data. The internal data of a class is called member data and functions are called member functions or mthods of class. The variables of the class type are often called objects or instances. Thus, a class is a definition of an object.
The class construct provides support for data hiding, abstraction, encapsulation, inherritance, polymorphism and public interface functions for passing messages between objects.
Concepts of OOPs terminology / Components of OOPs
1. Data Abstraction :
In OOPs data abstraction is defined and the collection of data and methods.
2. Data Hiding :
In C++, class construct allows to declare data and methods as public, private or protected group. The implementation details of class can be hidden. Private data of a class is also hidden to outside world i.e. private data of a class cannot be accessed outside the class. The only way to excess this private data of a class is by invoking the public methods/functions of the class. This is done by data hiding principle.
3. Data encapsulation :
The internal data of the class is first separated from outside world. The are the put along with the member functions in a capsule. In other words, encapsulation groups all the pieces of the object into one clean package. it avoids undesired side effects of member data when it is defined outside the class and also protects from the intentional misuse of important data. hence providing a kind of security to the object..
4. Inheritance:
C++ allows programmers to build hierarchy of classes. The features of class can be passed onto another class. Thus, the object of one class may acquire the properties of other calls as well as its own independent properties. Concept of inheritance provides the idea of reusability. i.e. a new class can be derived from existing class. There are many types of inheritance we will discuss later.
The new class, which is derived from other class, is called derived class and the class from which it is derived is called base class.
Syntax to inherit properties of class named class1 in the new class named class2
Class class2 extends public class1
{
members of class 2;
---------------------
---------------------
}
5. Dynamic Binding
Dyanmic binding means that the code associated with given procedure call is not known until the time of call at runtime. It is associated with polymorphism and inheritance.
6. Polymorphism:
Polymorphism is the ability to take more than one form. An operation may exhibit different behaviour in different instances. The behaviour depends on the type of data used in the operation. C++ allows a family of functions having same name but they must differ in number or type of arguments passed, and the function will be called according to the proper match of parameters
e.g. in the example given below
int max(int,int); //form 1
float max(float,float); //form 2
int max(int,int,int); //form 3
int max(int p,int q) // definition of form 1
{
if(p>q)
return(p);
else
return(q);
}
float max(float p,float q) // definition of form 2
{
if(p>q)
return(p);
else
return(q);
}
int max(int p,int q,int r) // definition of form 3
{
if(p>q && p>r)
return(p);
else if(q>r)
return(q);
else
return(r );
}
This entry was posted
on Saturday, December 20, 2008
at 5:28 AM
and is filed under
OOPS(OBJECT ORIENTED PROGRAMMING)
. You can follow any responses to this entry through the
comments feed
.
Categories
- ACL's
- Advanced Shellcoding Techniques
- Applications of databases
- Basic Networking
- CCNA / CCNP Tutorial: Introduction To NAT
- Cisco's Interior Gateway Routing Protocol
- Cisco's TCP/IP Implementation
- Computer
- COMPUTER HARDWARE
- Computer Hardware (Components Inside cabinet)
- COMPUTER NETWORKING
- Configuring ZoneAlarm Security Settings
- Create An Ftp Server On Your Pc With Serv-u
- Data Security
- Database security
- DATATYPES Etc......)
- DBMS building blocks
- DBMS Topics
- Distributed Database
- Dynamic Routing
- EXCEPTION HANDLING
- Features of the Web
- Flashget Broadband Tweak
- Fox Business Network
- FRIEND FUNCTION
- Generic functions
- Get Away From Trojans(ALL TROJAN PORTS).
- HARDWARE FIREWALL
- History of development
- HOW TO CAPTURE STREAMING MEDIA?
- How To Change Thumbnail Size And Quality
- How To Setup Your Own Dns (Domain Name Server)?
- Important tutorials
- INTERNETWORKING CHALLENGES
- INTRODUCTION TO ROUTERS
- IP and IPv6 Protocols
- JAVA DATATYPES
- JAVA (THREADS
- JAVA NOTES
- JAVA SCRIPT NOTES
- JAVA SCRIPT OBJECTS
- LATEST CONTENT ON BANDWIDTH
- Microprocessor 8085
- Mobile networking through Mobile IP
- MULTICASTING
- Network Fault Tolerance
- Network Port Scanners
- Network Topologies
- Networking(Types of networks)
- OOPS(OBJECT ORIENTED PROGRAMMING)
- OTHER PC HARDWARE COMPONENTS
- RIP and RIP2: Routing Information Protocol
- STRING
- The CTDP Protocol Summary Version 0.6.0
- Traffic Filtering
- Types Of Business Networking
- Types of Network
- Virtual Private Networking
- What Is Network Latency?