-
c Interface feature 1: They are all "virtual" and cannot be instantiated, which is why the interface cannot contain field member variables.
C Interface feature 2: Because the interface is virtual, the index, attributes, time, etc. in the interface can only be declared, but cannot be implemented in the interface, and the specific implementation is a matter of deriving the interface or deriving classes.
c Interface feature 3: all have the nature of a template, if an interface or class inherits from a certain interface, it will automatically have the characteristics of the integrated (including indexes, properties, functions, practices, etc.).
C interface feature 4: The interface supports multiple inheritance, while in C, the class supports single inheritance, and the interface actually represents a kind of carrying capacity.
The C interface contains declarations for methods, properties, indexers, and events, but the most common interfaces are usually methods and properties, but there is no specific implementation of the method in the interface (no member implementation is provided), only the return type and method name of the method. If a class implements an interface, it must include the implementation of all the methods in the interface, in other words, the class that inherits from the interface must contain the implementation of the functions in the interface.
For example: we all know that there are many kinds of bank accounts, like when we were students, we are generally savings cards (with functions such as saving money, withdrawing money, checking balances, etc.), after work, you may have a ** card, platinum card or something, and you may upgrade to a diamond card if you get rich, etc., then a bank account is equivalent to a class, and these different levels of bank accounts have some common basic functions (saving money, withdrawing money, balance, etc.) - this is an interface, However, there are some additional functions for high-ranking accounts to improve the bank's service level, so these account classes have both common functions and differences.
-
In fact, an interface is a specification that cannot be instantiated, indicating that it has a certain capability.
For example, if you write an interface with a method called in it, then you don't know how to call it, when the dog inherits this interface, the method of calling the interface is realized: Wangwang's barking, and the cat inherits this interface, and also implements the method of calling the interface: meow's calling.
-
Generally speaking, it is a goal, and the handle is the name of the goal, of course, this name is only temporary, and the next time you open it, you will change the name, that is, the number handle. For example, if I want to punch forward, this is equivalent to the front desk. What if I'm going to hit someone?
Then you have to find this person first, and the person you find is the handle, and you can operate on this handle. Found it, and then hit it with a fist...
-
A handle is a generic identifier of Windows objects (windows, processes, and resources), and the address of the object is the first memory address of the object.
As for why there is such a thing, because the API needs to be common to all languages of Windows, such a thing was invented.
-
int is the value type, and string is the reference type, the value type changes its value, and the reference passes the address, so the value on the address will also change.
-
Actually, you don't have to understand how complicated copying is! You just need to know that if you use ref, you are operating on the same variable, so the value will change, and if you don't use ref, you are not operating on the same variable, so the value will not change. That's it!
The rest, learn more in the future, and you will understand! Getting these questions right now will only make you miserable! It's just that with ref, the parameters of the call have to be initialized before the call, initialization, you know?
It's assignment!
-
The ref keyword is used to bring out the variables in the method after they are changed. Specifically, let's use examples to illustrate:
static void main(string args)static void add(int a, int b, ref int c)
The final result of the print is:
A3. If there is no ref parameter, there is no return value because there is no add() method, and the printed result is still 0 after the call
-
The transfer of control method means that the call to the swap() function is completed.
ref means "to quote". If the first ref is not added, the a,b used in the execution of the swap function, and the a,b outside the function are two pieces of data; When the ref is added, it is a piece of data.
-
Simple type data is not called back when it is called, that is, when it goes in, what is the parameter value, and what is the parameter value after the method is called.
The ref is added before the parameter to save the change of the parameter value, which is suitable for the transfer of simple data types.
-
Let's not talk about commissioning, at least the event should have been used, right? Events are a special kind of commission.
Alternatively, you can put int i=5;represents an integer variable i and assigns a value of 5, so what would you write if you were asked to represent a method with a variable?
This is the delegate, which abstracts the method and defines a delegate: public delegate void funa();
Then funa stands for a "method variable type", which can be defined as a "type method variable", and can be assigned to this variable by any method that returns a value of void without parameters.
e.g. funa a=func1;
-
A delegate is a thread.
Our CPUs are all more.
Processive CPUMultiple processes can be run at the same time. Once the exe is running, it is the process.
But the process doesn't work. It's the threads that work. There is at least one thread in a process.
The thread when the exe is started is the main thread, and it can control all the controls in the form.
Example: When clicking"Submit"button, the program is in the background when it needs to process a large amount of data and is extremely time-consuming"Fake stuck"State. This way the user experience is not good.
If you use a delegate. can be clicked"Submit"button when the button is not available, and a scroll appears to prompt the user"The system is processing. ", so it's more humane.
That is to say, the main thread control button is not available, and the scroll blade is displayed.
Delegated processing of data. When the processing is done, the button is available and the scroll blade disappears.
It can also be understood as a manifestation of dual-threading or multi-threading.
-
An attribute is an attribute, which represents the attribute of an attribute, a method, or a field.
Features aren't meant to be seen, they're generally used to tell the compiler something; VS will have special treatment for the elements that are marked with their own characteristics.
For example, the obsolete feature tells the compiler that the element is outdated, when you use a method with that markup; Grammar checking will tell you that this method is outdated.
Sometimes we can also use features to store some data, such as the display value of an enumeration.
VS has a lot of built-in features, and you can check out MSDN to see how to use them. v=
-
This is a question that you have to understand
1.The virtual method is meant to be rewritten, but it can have its own implementation.
2.Abstract Method: It's called abstract and easy to understand, but it doesn't provide a concrete implementation, it's just a rewritable (implicit) template of a virtual method (which can be understood as an interface).
3.Both of these methods are intended to be rewritten and implemented again, so they can't be sealed over, I don't have points, you give me some points, hehe.
-
As I understand it, overloading allows you to define multiple method implementations with different parameters with the same name, and the biggest implication is that a set of similar logic can be implemented with a unified batch of interfaces. In layman's terms, it is:
1. You can use the same name to achieve multiple similar logic, which looks like a relatively unified interface to the outside world, such as defining some columns of query methods, but the input parameters are different, using overloading, external calling, and seeing multiple overloads of a query method, it looks much more refreshing than the method you write multiple different names.
2. A series of similar logic can be encapsulated step by step in the form of overloading, and the final implementation logic can be put into a minimized unit to reduce the probability of error. That is, write the most flexible method first, and then overload, gradually reduce the flexibility of the overloaded method in order to adapt to specific needs, and the final implementation logic is encapsulated in the most flexible method, so that the logic can be uniformly controlled.
For example, there are a series of query methods with the same name, all of which query users:
public listgetusers(string username)
public listgetusers(string username, int? age, int? genger)
public listgetusers(string where)
Imagine if the above three methods are written with different method names and each implements its own logic, which is not good-looking, and the logic is dispersed into three methods, which greatly increases the probability of error, but in fact they can ultimately be controlled by one implementation.
-
First of all, you need to understand what method overload is, the method name is the same, the parameter type is different, the number of parameters, and the return type can be the same or different. From the above definition, we can conclude that we can call the same method name, but can implement different functions. For example, I have two objects, A and B.
Object A wants to call the method fun to achieve the function of addition, so we write the fun method and implement an addition in it. And object B also wants to call the method fun, but it is to achieve subtraction, at this time, the direct call of fun can only achieve addition, what should I do? Method overloading, which comes in handy, we overload fun, accept different arguments and return values, and we can call the same method, but implement a different function.
-
The most useful thing is that you can output it as you wish, which is the customer's requirements.
The use of natural enemy organisms, microorganisms and their derivatives to control pests and diseases is called biological control. Main content: >>>More
bool is a boolean variable, that is, a determinant of a logical variable, similar to float, double, etc., except that float defines floating-point and double defines double-precision floating-point. Boolean variables have only true and false values. Examples: >>>More
do is used to loop.
For example. int i=1,sum=0; >>>More
Indexer definitions are similar to properties but their functionality is not the same as properties Indexers provide a special way to write get and set accessors Properties can access an object's data in the same way as a field Indexers allow users to access class members in the same way as arrays The syntax for defining an indexer is as follows: >>>More
There are two kinds of self-increment and self-reduction, one is the forward fall (++i,--i), and one suffix (i++, i--) There is a big difference between the two, and the prefix self-increment and self-decrease is to run itself first, and then run others. The suffix is self-incrementing and self-decreasing, which is to run the other first in the run itself. >>>More