Friday, 6 April 2018
Inheritance is the process by which object of one class an acquire the properties of another class.
Inheritance helps for software reusability in which new classes are created from existing classes by absorbing their attributes and behaviors.
If user want data member and member function of existing class, user can inherit data member and...
Thursday, 5 April 2018
Rules for Binary operator
Irawen April 05, 2018 C++ No comments
Only existing can be overloaded. New operators can not be created.
The overloaded operator must have at least one operand that is user defined type.
We can not change the basic meaning of operator.
Overloaded operator follows the syntax rules of the original operators. They can not be overridden
There are some operators which can not be overloaded...
Limitation OR Pitfalls of Operator Overloading
Irawen April 05, 2018 C++ No comments
The prefix ++ or - notation (Ex ++x or --x) cause a variable to be updated before its value is used in the expression , where as postfix ++ or -- notation (Ex x++ or x--) Cause it to be updated after its value is used. However , the statement,
++s;
Has exactly the same effect statement
s++;
When ++...
Overloading Binary Operator
Irawen April 05, 2018 C++ No comments
Binary operations are performed which require two operands to perform operations.
To add two numbers generally we use statement like
C = sum(A,B); //Functional Notation
This functional Notation can be replaced by natural looking expression
C = A + B;
...
Overloading Unary Operator
Irawen April 05, 2018 C++ No comments
First we consider the unary operator. Let consider unary operator unary minus ( - ) , when it is used, it takes just one operand.
We know that unary minus (-) operator changes the sign of an operand when applied to basic data item.
We have overloaded this operator so that it should be operated to an object in the same way as applied to an int or...
Operator Overloading
Irawen April 05, 2018 C++ No comments
Cpp allows user to overload most operators so that they should perform special operations relative to classes that user create.
Cpp tries to make user defined data types behaves in much the same way as in built in types.
Cpp permits us to add two variables of user defined types with the syntax that is applied to basic types.
Cpp provides the operator...
Wednesday, 4 April 2018
'new' and 'delete' Operators
Irawen April 04, 2018 C++ No comments
In 'C' , we have used malloc( ), calloc( ), and realloc( ) function to allocate memory dynamically that is at the run time. 'C++' also provides these function but other than this it supports new unary operators 'new' and 'delete' to allocate and to free memory at run time in a better and easier way than the above functions.
Advantages of using 'new'...
'this' Pointer
Irawen April 04, 2018 C++ No comments
We know that pointer is a variable which holds address of some other variable an we can access the data of another variable using pointer technique.
'this' is special type of pointer which holds the address of objects which invokes the member function of the class.
Whenever any object calls its member function, 'this' pointer is automatically set...
Function Returning Pointer Object
Irawen April 04, 2018 C++ No comments
We know that function can return any data type. In the same way we can return pointer variable that is user defined pointer variable or system defined pointer variable from the function.
The general syntax:
returntype * functionname(Argument_list)
{
}
Here returntype is the data type of the value which is returned by the function and functionname...
Array of Pointers to Objects
Irawen April 04, 2018 C++ No comments
We can create an array of objects using pointers. For this we can use following syntax.
classname *pointer_var[size];
WAP to demonstrate array of pointers to objects
#include<conio.h>
#include<iostream.h>
class emp
{
char name[20];
float age;
public:
void getdata( );
void putdata( );
};
void emp::getdata( )
{
cout<<"\n\nEnter...
Pointer To Object
Irawen April 04, 2018 C++ No comments
As we create a simple object of class similarly we can create object of the pointer type of class.
For Example if we have a class with the name item, then we can create an object for item class as
item x;
Whenever item is a class and x is an object of item class, similarly we can define object of the type pointer as item *ptr;
There are two ways...
Pointers to Strings
Irawen April 04, 2018 C++ No comments
A string is an array of characters terminated by a special character called as a null character.
Pointer to the string is a pointer which is initialized to the base address of the first location in string.
Syntax for declaring a pointer to string.
Datatype *pointer_variable;
Ex : char *ptr;
To initialize the pointer to the address of the string...
Tuesday, 3 April 2018
Pointer in Arrays
Irawen April 03, 2018 C++ No comments
Consider the declaration
int b[5];
int *ptr;
The pointer to array is given as below
ptr=&b[0];
which is same as
ptr=b;
If the pointer is incremented to the next data elements , then address of the incremented value of the pointer will be same as the value of the next element.
ptr=&b[0] ...
Pointers to Functions
Irawen April 03, 2018 C++ No comments
1. Cpp allows functions to be referenced by a pointer.
2. A pointer to a function must be declared to be a pointer to the datatype returned by the functions like void , int , float and so on....
3. In addition , the argument type of the function must also be specified when a pointer is declared.
4. The argument declaration is a list of a formal argument...
Popular Posts
-
While Excel remains ubiquitous in the business world, recent Microsoft feedback forums are full of requests to include Python as an Excel ...
-
Explanation try block: Python runs the code inside the try block first. print("Hello") executes normally, so it prints: Hel...
-
Understanding the code: 1. range(0, 6, 4) This means: Start from 0, go up to (but not including) 6, and increment by 4. So, it genera...
-
Line-by-line explanation: prod = getProd(4,5,2) This line is trying to call a function named getProd with arguments 4, 5, and 2. How...
-
This is a recursive function . It calculates the sum of all numbers from 1 to num. How does recursion work here? Let's see how sum(5...
-
Exploring Python Web Scraping with Coursera’s Guided Project In today’s digital era, data has become a crucial asset. From market trends t...
-
100 Data Structure and Algorithm Problems to Crack Coding Interviews Unlock your potential to ace coding interviews with this comprehensiv...
-
Step 1: color = 'white' This assigns the string 'white' to the variable color. Step 2: color[4] Python strings are ...
-
Learning LangChain: Building AI and LLM Applications with LangChain and LangGraph LangChain is an open-source framework designed to simplif...
-
What happens: num = 6 A variable num is created and assigned the value 6. decrement(num) This calls the decrement function and pass...
Categories
100 Python Programs for Beginner
(98)
AI
(41)
Android
(24)
AngularJS
(1)
Api
(2)
Assembly Language
(2)
aws
(17)
Azure
(7)
BI
(10)
book
(4)
Books
(200)
C
(77)
C#
(12)
C++
(83)
Course
(67)
Coursera
(251)
Cybersecurity
(25)
Data Analysis
(3)
Data Analytics
(3)
data management
(11)
Data Science
(149)
Data Strucures
(8)
Deep Learning
(21)
Django
(16)
Downloads
(3)
edx
(2)
Engineering
(14)
Euron
(29)
Events
(6)
Excel
(13)
Factorial
(1)
Finance
(6)
flask
(3)
flutter
(1)
FPL
(17)
Generative AI
(11)
Google
(36)
Hadoop
(3)
HTML Quiz
(1)
HTML&CSS
(47)
IBM
(30)
IoT
(1)
IS
(25)
Java
(93)
Java quiz
(1)
Leet Code
(4)
Machine Learning
(86)
Meta
(22)
MICHIGAN
(5)
microsoft
(4)
Nvidia
(4)
Pandas
(4)
PHP
(20)
Projects
(29)
pyth
(1)
Python
(1058)
Python Coding Challenge
(461)
Python Quiz
(130)
Python Tips
(5)
Questions
(2)
R
(70)
React
(6)
Scripting
(3)
security
(3)
Selenium Webdriver
(4)
Software
(17)
SQL
(42)
UX Research
(1)
web application
(8)
Web development
(4)
web scraping
(2)