-
Overload: is the ability of a program to define multiple members of the same name in the same class. (The only difference between multiple overloaded members is that they have different parameter types or number of parameters).
class program
static void main(string args) 5.The entry point of the main function.
equalclass equalstr = "Override the "=" operator";
string str = equalstr;
6.Outputs the overloaded value of the Public Static Implicit Operator String(EqualClass Mystr).
class equalclass
private string _str;
private equalclass(string str) 1.A constructor that defines equalclass.
this._str = str; 2.Assign a value to str with str.
public static implicit operator equalclass (string str)
return new equalclass (str );3.Overload equalclass
public static implicit operator string(equalclass mystr)
return mystr._str; 4.Overload string
The program flow is marked out!
The key point is the use of the overloaded method: Public Static Implicit Operator EqualClass (String str).
Public Static Implicit Operator String(EqualClass Mystr)
This app is not convenient for you to understand the concept of overloading! It's better to find an overloaded program like "+"!
I hope the above is helpful to you!!
-
Overloading is an object-oriented feature, and it's a bit difficult to understand, but if you do, then a lot of object-oriented features, such as interfaces, constructors, and so on, are easy to understand. equalclass is a constructor.
-
Priority is the same.
C, relative to C++, except for the &take address operator before the variable name and the value operator in *take the address, all others have (unsafe available.
The default type, if there is no decimal point, it is int, if there is a double character, and the default Unicode character set is the default type.
array c:int name; c++int name
-
There is the same, and the same.
For example, the generic int float is the same.
For example, the definition of array types is different.
-
Simple operators are the same.
-
Example: -8%3=-2
Finding the remainder of a negative number is mainly based on the dividend, and has nothing to do with the divisor.
If the dividend is negative, then the result must be negative. If both the dividend and the divisor are negative, the result is still negative.
If the dividend is positive and the divisor is negative, the result is positive.
-
In c, the remainder sign is the same as the dividend.
That is: -17%3 ==2
-
1. % is the remainder operation, that is, the modulo operation (mod).
2. Let a and b be two integers, and the result of a%b is the remainder obtained by a b.
For example, 5%3=2 (quotient 1 surplus 2) 9%4=1 (quotient 2 surplus 1) 3%7=3 (quotient 0 surplus 3).
-
The result is the same as the dividend sign.
For example, 5%3 results in 2
5%-3 results are also 2
5%3 The result is -2
5%-3 results are also 2
-
In C++, the use of new is flexible, and here is a brief summary:
new() allocates a size of memory space of this type and initializes this variable with the value in parentheses;
new allocates n sizes of memory space of this type and initializes these variables with the default constructor;
When a multidimensional array variable or array object is defined using the new operator, it produces a pointer to the first element of the array, and the returned type maintains all dimensions except for the leftmost dimension.
Delete is used to free up the requested memory space.
You can use delete to release space requested by new, and you can use delete to release space requested by new
-
fun(10) += 20:
First fun(10), n is 10, and then n is returned
Then n += 20, so n is 30
In essence, it is:
fun(10);
n+=20;
Later, fun(10) = fun(10) +20;
where fun(10) makes n=10, another fun(10) makes n=20, and then n = n + 20 (...).
So fun(10);
fun(10);
n = n + 20;
-
The question is similar to:
int a = 0;
+a += 10
+a = ++a + 20
The self-incrementing statement in is executed only once.
will be executed twice...
-
The a you have here is a function, and it will increase the global variable by 10, and calling twice will definitely not work the same as calling once.
-
n is the global variable fun(10)=fun(10)+20; It's equivalent to calling the function twice, each time giving n +10 for itself, plus twenty is forty.
-
Ask me, what do you mean by your (2) statement? What do you want to achieve? I didn't get it.
-
C language operations.
Symbol 1 level priority Left binding.
Parenthesis. Subscript operator.
Point to the struct member operator.
Struct member operator.
Level 2 Priority Right Bond.
Logical non-operators.
Bitwise negation operator.
Autoincrement operator.
Self-decrement operator.
Negative operator.
Type) type conversion operator.
Pointer operator.
Addresses and operators.
sizeof length operator.
Level 3 Priority Left Bond.
Multiplication operators.
Division operator.
Remainder operator.
4 levels of priority Left binding.
Addition operators.
Subtraction operators.
5 levels of priority Left binding.
Shift Left operator.
Shift right operator.
6 levels of priority Left binding.
<=, >, = relational operators.
7 levels of priority Left binding.
Equals operator.
Not equal to the operator.
8 levels of priority Left binding.
Bitwise and operators.
9 levels of priority Left binding.
Bitwise XOR operators.
10 levels of priority Left binding.
Bitwise or operator.
11 levels of priority Left binding.
Logic and operators.
12 levels of priority Left binding.
Logic or operators.
13 levels of priority right binding.
Conditional operators.
14 levels of priority right binding.
= -= *= /= %= &= ^= |= <<= >>= are all assignment operators.
15 levels of priority Left binding.
Comma operator.
-
No.. 456 will become 11100 if you move four places to the right first, and then four places to the left will be 448.
At this time, the value of 456 has changed. It's not 456 anymore. You do the math that 32*14 is exactly equal to 448. Then use 456-448=8 to get the remainder of 456%32 of 8.
In fact, this problem is related to shifting left and shifting right.
Because it's not a loop left or a loop right. Then there will be a removal that can only be filled with 0, and the value will be changed at this time. Do the math carefully.
-
First of all, you have to remember the rules of displacement: if you move left, you need to make up 0 to the right, and if you move right to make up 0 to the left
The binary of 456 is 111001000
456 >>4 displacement 4 bits are: 0000111000001110 displacement 4 bits is: 11100000 is equal to decimal 448j = 456-448 = 8
j=456%32=8
So they are equivalent, do you understand? /
-
Move 4 bits to the left and move back 4 bits, the key is to move back with a 00101101 supplemented with 0
4 becomes. 4 becomes.
Do you see why?
-
12 is expressed as 0x0c in hexadecimal and shifted eight bits to the left as 0x0c00
i.e. 1 | 0x0c00 | 0x00000 | 0x40000 = 1 | 0x0c00 | 0x40000 | = 0x40c01
-
"=" is the assignment symbol, and "==" is a relational operator, for example, a=b is to assign the value of b to a, and a==b is to determine whether a and b are equal, if they are equal, "a==b" is true, otherwise it is false.
-
= arithmetic operator, which is used to assign values, such as int a=10; Then the value of the variable a is 10.
is a logical operator, int a=10, b=20; if(a==b){printf("Two numbers are equal");== is a comparison of the numbers on both sides.
-
= is an assignment.
It is to judge whether it is equal or not.
: has a higher priority than =
Below << >>>More
> operator (c reference).
The Shift Right operator (> moves the first operand to the right by the number of bits specified by the second operand. >>>More
+ Follow the right binding rule;
a=++i++;Equivalent to int temp=i++, a=++temp; >>>More
Boolean logic operators are used to represent a logical relationship between two search terms to form a concept. >>>More
Dizzy, the manager of the fifth level above, seeing that your level is quite high, why don't you give a decent answer? It's like a fortune teller. Nothing.