Using Namespace STD Int Main (String STR ("Please Split This")
Using Namespace STD Int Main (String STR ("Please Split This")
String Token
#include<iostream>
#include<cstring> //stcpy,strtok
#include<string>
using namespace std;
int main() {
string str ("Please split this");
char* cstr = new char[str.length()+1];
strcpy(cstr, str.c_str());
char*p = strtok(cstr, " ");
while (p!=0)
{
cout << p << '\n';
p = strtok(NULL, " ");
}
delete[] cstr;
}
class templates
template< typename T>
class LinkedList
{
public:
void add( T x);
void print(void);
};
operator expression
Value& operatorr=(const Value &rhs);
Value operator* (const &p, const Value &q)
rewrite c = a*b
c.operator=(operator*(a,b))
overloaded >
bool operator>(const Value& x) const
{
return I > x.i;
}
read/write file
Overloaded +
XYpoint& operator+(XYpoint& rhs) {
this->x += rhs.getX();
this->y += rhs.getY();
};
An overloaded function is a function that shares its name with one or more other functions, but which has
a different parameter list. The compiler chooses which function is desired based upon the arguments used.
An overridden function is a method in a descendant class that has a different definition than a virtual function in an ancestor class. The compiler chooses
which function is desired based upon the type of the object being used to call the function.
A redefined function is a method in a descendant class that has a different definition than a non virtual function in an ancestor class.S ince the method is
not virtual, the compiler chooses which function to call based the static type of the obj reference rather than the actual t ype of obj.
this point is a ptr provides the address of the current instance of a class