Download CBSE Class 12 Computer Science Oops Notes in PDF format. All Revision notes for Class 12 Computer Science have been designed as per the latest syllabus and updated chapters given in your textbook for Computer Science in Class 12. Our teachers have designed these concept notes for the benefit of Class 12 students. You should use these chapter wise notes for revision on daily basis. These study notes can also be used for learning each chapter and its important and difficult topics or revision just before your exams to help you get better scores in upcoming examinations, You can also use Printable notes for Class 12 Computer Science for faster revision of difficult topics and get higher rank. After reading these notes also refer to MCQ questions for Class 12 Computer Science given on studiestoday
Revision Notes for Class 12 Computer Science Oops
Class 12 Computer Science students should refer to the following concepts and notes for Oops in Class 12. These exam notes for Class 12 Computer Science will be very useful for upcoming class tests and examinations and help you to score good marks
Oops Notes Class 12 Computer Science
BASIC CONCEPTS OF OOPS & CLASSES AND OBJECTS
Object-Oriented Programming groups related data and functions together in a class, generally making data private and only some functions public. Restricting access decreases coupling and increases cohesion. It has proven to be very effective in reducing the complexity increase with large programs. For small programs may be difficult to see the advantage of OOP over, eg, structured programming because there is little complexity regardless of how it's written.
It helps in programming approach in order to built robust user friendly and efficient software and provides the efficient way to maintain real world software. OOP 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 DataHiding, Inheritance Data Abstraction, Data Encapsulation and many more. The main aim is to creating an Object to the Entire program and that to we can control entire program using the Object. The main features of OOPS is Polymorphism, Multiple Inheritance, Abstraction and Encapsulation.
Objects:
Object is the basic unit of object-oriented programming. Objects are identified by its unique name. Anobject represents a particular instance of a class.
An Object is a collection of data members and associated member functions also known as methods.
Classes:
· Classes are data types based on which objects are created.
· Thus a Class represents a set of individual objects. Characteristics of an object are
represented in a class as Properties. The actions that can be performed by objects become functions of the class and are referred to as Methods.
· Classes are the blueprints upon which objects are created. E.g when we design a map of the house, the architect first designs it. Once it is designed, the raw material is used to build the house. In this example, Design of the house is CLASS (blueprint) and the house built on the basis of design is an object.
No memory is allocated when a class is created. Memory is allocated only when an object is created, i.e., when an instance of a class is created.
Inheritance:
· Inheritance is the process of forming a new class from an existing class or base class. The base class is also known as parent class or super class. The new class that is formed is called derived class.
· Derived class is also known as a child class or sub class. Inheritance helps in reducing the overall code size of the program, which is an important concept in object-oriented programming. It is the process by which one class inherits the properties of another Class.
Data Abstraction:
· Data Abstraction increases the power of programming language by creating user defined data types.
· Data Abstraction also represents the needed information in the program without presenting the details.
Classes
Public and Private sections
All member fields in a class are private by default (no code outside the class can reference them),
whereas fields of a struct are public, meaning that anyone can use them. For example,
struct Product {char mfg_id[4]; // 4 char code for the manufacturer.
char prod_id[8]; // 8-char code for the product
int price; // price of the product in dollars.
int qty_on_hand; // quantity on hand in inventory
};
Could be rewritten as a class like this
class Product {
public:
char mfg_id[4]; // 4 char code for the manufacturer.
char prod_id[8]; // 8-char code for the product
int price; // price of the product in dollars.
int qty_on_hand; // quantity on hand in inventory
};
A class is an expanded concept of a data structure: instead of holding only data, it can hold both data and functions.
An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable.
Classes are generally declared using the keyword class, with the following format:
class class_name {
access_specifier_1:
member1;
access_specifier_2:
member2;
...
} object_names;
Where class_name is a valid identifier for the class, object_names is an optional list of names for objects of this class. The body of the declaration can contain members that can either be data or function declarations, and optionally access specifiers.
All is very similar to the declaration on data structures, except that we can now include also functions and members, but also this new thing called access specifier. An access specifier is one of the following three keywords: private, public or protected. These specifiers modify the access rights that the members following them acquire:
• private members of a class are accessible only from within other members of the same class or from their friends.
• protected members are accessible from members of their same class and from their friends,
but also from members of their derived classes.
• Finally, public members are accessible from anywhere where the object is visible.
By default, all members of a class declared with the class keyword have private access for all its members. Therefore, any member that is declared before one other class specifier automatically has private access. For example:
class CRectangle { int x, y;
public:
void set_values (int,int);
int area (void);
} rect;
Declares a class (i.e., a type) called CRectangle and an object (i.e., a variable) of this class called rect. This class contains four members: two data members of type int (member x and member y) with private access (because private is the default access level) and two member functions with public access: set_values() and area(), of which for now we have only included their declaration, not their definition.
Notice the difference between the class name and the object name: In the previous example, CRectangle was the class name (i.e., the type), whereas rect was an object of type CRectangle. It is the same relationship int and a have in the following declaration:
int a; where int is the type name (the class) and a is the variable name (the object).
After the previous declarations of CRectangle and rect, we can refer within the body of the program to any of the public members of the object rect as if they were normal functions or normal variables, just by putting the object's name followed by a dot (.) and then the name of the member. All very similar to what we did with plain data structures before. For example:
rect.set_values (3,4);
myarea = rect.area();
The only members of rect that we cannot access from the body of our program outside the class are x and y, since they have private access and they can only be referred from within other members of that same class.
Here is the complete example of class CRectangle:
class CRectangle {int x, y;
public:
void set_values (int,int);
int area () {return (x*y);}
};
void CRectangle::set_values (int a, int b) {x = a; y = b;}
int main () {CRectangle rect;
rect.set_values (3,4);
cout << "area: " << rect.area();
return 0;}
The most important new thing in this code is the operator of scope (::, two colons) included in the definition of set_values(). It is used to define a member of a class from outside the class definition itself.
You may notice that the definition of the member function area() has been included directly within the definition of the CRectangle class given its extreme simplicity, where asset_values() has only its prototype declared within the class, but its definition is outside it. In this outside declaration, we must use the operator of scope (::) to specify that we are defining a function that is a member of the class CRectangle and not a regular global function.
The scope resolution operator (::) specifies the class to which the member being declared belongs,bgranting exactly the same scope properties as if this function definition was directly included within thebclass definition. For example, in the function set_values() of the previous code, we have been able to use the variables x and y, which are private members of classCRectangle, which means they are only accessible from other members of their class.
The only difference between defining a class member function completely within its class or to include only the prototype and later its definition, is that in the first case the function will automatically be considered an inline member function by the compiler, while in the second it will be a normal (notinline) class member function, which in fact supposes no difference in behavior.
Members x and y have private access (remember that if nothing else is said, all members of a class defined with keyword class have private access). By declaring them private we deny access to them from anywhere outside the class. This makes sense, since we have already defined a member function to set values for those members within the object: the member function set_values().
Therefore, the rest of the program does not need to have direct access to them. Perhaps in a so simple example as this, it is difficult to see any utility in protecting those two variables, but in greater projects it may be very important that values cannot be modified in an unexpected way (unexpected from the point of view of the object).
One of the greater advantages of a class is that, as any other type, we can declare several objects of it. For example, following with the previous example of class CRectangle, we could have declared the object rectb in addition to the object rect:
class CRectangle { int x, y;
public:
void set_values (int,int);
int area () {return (x*y);}
};
void CRectangle::set_values (int a, int b) { x = a; y = b;}
int main () { CRectangle rect, rectb;
rect.set_values (3,4);
rectb.set_values (5,6);
cout << "rect area: " << rect.area() << endl;
cout << "rectb area: " << rectb.area() << endl;
return 0;}
In this concrete case, the class (type of the objects) to which we are talking about is CRectangle, of which there are two instances or objects: rect and rectb. Each one of them has its own member variables and member functions.
Notice that the call to rect.area() does not give the same result as the call to rectb.area(). This is because each object of class CRectangle has its own variables x and y, as they, in some way, have also their own function members set_value() and area() that each uses its object's own variables to operate.
That is the basic concept of object-oriented programming: Data and functions are both members of the object. We no longer use sets of global variables that we pass from one function to another as parameters, but instead we handle objects that have their own data and functions embedded as members. Notice that we have not had to give any parameters in any of the calls to rect.area or rectb.area. Those member functions directly used the data members of their respectiveobjects rect and rectb.
Constructors and Destructors
· Constructors and destructors are special member functions of classes that are used to construct and destroy class objects. Construction may involve memory allocation and initialization for objects.
· Destruction may involve cleanup and deallocation of memory for objects.
Please click the link below to download pdf file for CBSE Class 12 Computer Science - Basic Concepts Of Oops.
CBSE Class 11 Computer Science Computing and Binary Operation Notes |
CBSE Class 12 Computer Science Oops Notes
We hope you liked the above notes for topic Oops which has been designed as per the latest syllabus for Class 12 Computer Science released by CBSE. Students of Class 12 should download and practice the above notes for Class 12 Computer Science regularly. All revision notes have been designed for Computer Science by referring to the most important topics which the students should learn to get better marks in examinations. Our team of expert teachers have referred to the NCERT book for Class 12 Computer Science to design the Computer Science Class 12 notes. After reading the notes which have been developed as per the latest books also refer to the NCERT solutions for Class 12 Computer Science provided by our teachers. We have also provided a lot of MCQ questions for Class 12 Computer Science in the notes so that you can learn the concepts and also solve questions relating to the topics. We have also provided a lot of Worksheets for Class 12 Computer Science which you can use to further make yourself stronger in Computer Science.
You can download notes for Class 12 Computer Science Oops for latest academic session from StudiesToday.com
Yes, the notes issued for Class 12 Computer Science Oops have been made available here for latest CBSE session
There is no charge for the notes for CBSE Class 12 Computer Science Oops, you can download everything free of charge
www.studiestoday.com is the best website from which you can download latest notes for Oops Computer Science Class 12
Come to StudiesToday.com to get best quality topic wise notes for Class 12 Computer Science Oops