A suggested method to help students answer UPSR Paper 2 Section C English
assignment of ignouFull description
psim manual of power electronicsFull description
MKSAP for studentsDescrição completa
fhytyyr6yyhgjuFull description
Full description
Full description
Tabla for the students of post-grad students.Full description
Sample thesis for tourism students. Anyone can download this file. It's free. Hope it can help.
Legal Logic
durga soft kiran sir c language notes
Programming paradigm: Programming Programming paradigm means that the fundamental of computer programming. Programming Programming style or methods are changed from language to language. There are three programming paradigm – paradigm –
1. Imperative / Procedural: Imperative programming languages are the most traditional once. Their code consists of sequential statements to achieve the desired goal. For Ex: Basic and Pascal 2. Functional / Modular: Functional programming programming languages are as name suggest, the problems are divided into functions / modules. For Ex: C 3. Object Oriented: Object oriented programming languages; they mainly focus around objects that have their own properties and procedural / method. It is also possible to create classes that include the functionality of other already existing classes. Need of OOPs: Characteristics Characteristics of OOPs: i. Emphasis on data rather than procedure. ii. Programs are divided into what are known as objects. iii. Function and data are tied together in a data structure. iv. Data is hidden and cannot be accessed by external functions. v. Objects may communicate with classes through functions. vi. New data and functions functions can be easily easily added whenever necessary. vii. Follows bottom up approach in program design.
a. b. c. d. e.
Some other characteristics included in C++: Ability to declare variable anywhere. New data types like long long int, int, Boolean and complex data type type to denote complex numbers. New header file such as stdbool.h, stdbool.h, inttypes.h. inttypes.h. C++ supports exceptional handling for handling errors. C++ introduced new keywords like new, delete, inline, public, private, this etc.
Comparative study of C and C++: Designed by String type
Major Implementations Program I/O Speed
Program Include Language type Influenced Appeared in OOP Paradigm Execution flow
C Designed by Dennis Ritchie
Cannot use string type by declare it using as an array of characters GCC, Borland C, MS VC scanf for input or printf for output C applications are faster to compile and execute than C++ applications Uses #include Procedural oriented language awk, C#, objective-C, Pearl, PHP, Java, C++, JavaScript 1972 Not built in Procedural system implementation language Top to Bottom
C++ Designed by B. Jarne Stroustrp Can use string type, using ‘string’ data type
MSVC++ cin for input or cout for output C++ applications are generally slower at runtime and are much slower to compile than C Uses #include Object Oriented language Java, PHP, Pearl, JavaScript, Ada 95, D 1985 Yes, polymorphism and inheritance Multi paradigm language Bottom to Top
Principles of Object oriented programming: Objects: i. Objects are basic runtime entities in an object oriented system. ii. In Structured programming problem is divided into function unlike this, in OOPs the problem is divided into objects. Diagram Class:
Language supports different data type like int, float, char, long, structure etc. Similar to that C++ supports class data type. A class data type contains variable and functions. They can be accessed through class variables (Objects). (Objects). For Ex: Fruit is a class. Then mango, orange will be objects of class. Inheritance:
It is a process by which object of one class acquire the properties of object of another class. The concept of inheritance provides the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving a new class from the existing once. The new class will have the combined feature of both the classes.
Abstraction:
It is referred to the act of representing essential feature without including background detail detail or explanation. Class use the concept of abstraction abstraction and are are defined as abstract attributes such as size, weight and cost.
Encapsulation:
The wrapping of data and functions into a single unit (class) is known as encapsulation. The data is not accessible to outside world and those functions which are wrapped into the class can access it. It is also known as data hiding. Polymorphism:
It means use one thing in more than one form. Operator overloading overloading & function overloading are examples of polymorphism. polymorphism. Function Overloading: The function name has more than one definition in a class according to arguments passed to a function. function. Operator Overloading: Uses predefined operators as function name and allow giving it new definition.
Structure of C++ Program: Include file Class declaration Member function definition Main function
1. Include File: In this section, we add header files and resource files. These files provide definition for function and object used in a program. 2. Class Declaration: In this area class is defined. Ex: class demo { Member variables and functions }; 3. Member Function Definition: In this section class member, function and other functions are defined. Ex: demo :: fun() { Definition } 4. Main Function: This is special type of function that is called at the beginning of program execution. Each program must have one main function. int main() { return 0; }
Reference Variable: A reference variable provides an alias (alternative name) for a previously defined variable. Syntax: Data type & reference_name = variable_name; Ex: int a=10; int &b=a; Comparative study of pointer & reference variable: i. A pointer can be reassigned any number of time, while a reference variable cannot be reassigned after initialization. ii. A pointer can point to NULL but reference variable always point to a value. iii. We cannot take the address of reference variable like we can do with pointer variable.
Note: Some other properties of C++ Declaration of variable: The C++ allows the declaration of variable anywhere in the program. Dynamic initialization of variable: Variable can be initialized at runtime using expression at the place of declaration. Ex: int sum; int a=sum;
Memory Management Operators in C++: To allocate memory, C++ supports two unary operators new and delete. These operators allocate and deallocate the memory in better and easy way.
Advantages of new operator over malloc function: i. It automatically computes the size of data object. We need not use the operator sizeof(); ii. It automatically returns the current pointer type so there is no need to type cast. iii. Like any other operator new and delete can be overloaded. iv. It is possible to initialize the object while allocating the memory. Syntax for “ new ”: Data type pointer_variable = new data type; Ex: int *p = new int; OR int *p; *p = new int;
Note: We can also initialize the memory using new operator. Pointer_variable = new data type (value); Ex: int *p = new int (0); Note: We can also allocate memory space to array. Pointer_variable = new data type [size]; Ex: int *p = new int[5];
Inline Function: Inline function’s definition is placed where it is called in the program. It provides faster execution by ignoring the function calling process. Member function of class is defined inline by default. We can define any function as inline using the keyword inline while defining it.
If following statements written in function body, the inline function may not work – If inline function is recursive. Loop, switch and goto statement Static variable Returning from exit(0) statement
Constructor: A constructor is a special member function whose task is to initialize the object of its class. Constructor name is the same as the class name. The constructor is called whenever an object of its associated class is created. For Ex: class integer () { private: int n, m; public: integer () { n=0; m=0; } };
i. ii. iii. iv.
Characteristics of Constructor: They should be declared in public section. They are called automatically when class objects are declared. They do not have return type so they cannot return any value. They cannot be inherited, derived class can call base call constructor.
Types of constructor: 1. Default constructor 2. Parameterized constructor 3. Copy constructor 1. Default constructor: When a constructor is called without any argument and it is called automatically when object is created, this is called default constructor. 2. Parameterized constructor: When a constructor is called with parameters while creating an object; such type of constructor is called parameterized constructor. class integer () { private: int n, m; public: integer () //Default {
n=0; m=0; } integer (int x, int y); };
integer::integer(int x, int y) //Parameterized { n=x; m=y; } 3. Copy constructor: A constructor takes a reference of an object of the same class, itself as an argument. A reference variable is used as argument in constructor such a constructor is called copy constructor.
class emp { private: int id; public: emp(int a) { id=a; } emp(emp &obj) { id=obj.id; } Void display() { cout<<”id”<
emp y(x); cout<<”x”; x.display(); cout<<”y”; y.display(); }
Destructor: A member function that names same as class name preceded by a tilde (~) sign. Such types of function are called destructor.
class ex { static int count; public: ex() { count++; cout<<”No. of object created”<
Operator Overloading in C++: It is a special feature of C++. C++ allows operators to be use as function name and allow user to redefine them with new functionality. Return_type classname::operator op() { statements } Unary operator overloading: When we have an operator that works on single operand such type of overloading is known as unary operator overloading. class minus { private: int a,b,c; public: void get() { cout<<”Enter value”; cin>>a>>b>>c; }