Home >Backend Development >C#.Net Tutorial >10 recommended articles about derived classes
This article mainly introduces the calling methods of C# interface in derived classes and external classes, and analyzes the definition and specific usage of C# interface in the form of examples. Friends in need can refer to the examples in this article to describe the use of C# interfaces in derived classes. Calling methods in classes and external classes. Share it with everyone for your reference, the details are as follows: C# interfaces are created through the interface keyword, and the interface can contain member variables such as properties and methods. Derived classes of interfaces can implement methods in the interface. A class can inherit multiple interfaces to implement the methods in these interfaces, and an interface can also derive multiple classes. The methods in the interface can be implemented by one or more of these classes. Methods in the interface can be directly called in derived classes of the interface. Example of calling in a derived class: //Interface public interface IPersonalService { //Methods in the interface PersonalDTO QueryByUid(int uId)
1. 10 recommended articles about external classes
Introduction: This article mainly introduces the calling methods of C# interface in derived classes and external classes. It analyzes the definition and specific usage of C# interface in the form of examples. Friends in need can refer to this article. The example describes the calling methods of the C# interface in derived classes and external classes. Share it with everyone for your reference, the details are as follows: C# interfaces are created through the interface keyword, and the interface can contain member variables such as properties and methods. Derived classes of interfaces can implement methods in the interface. A class can inherit multiple interfaces to implement the methods in these interfaces, and an interface can also delegate...
Introduction: This article mainly introduces the use of C# interfaces in derived classes and external The calling method in the class, combined with the example form, analyzes the definition and specific usage of the C# interface. Friends in need can refer to
3. C# Design Pattern - Derived Class Implementation Example code sharing of non-virtual interface trap
# Introduction: At first glance, implementing interfaces and overriding There seems to be no difference between writing virtual methods. In fact, there is a big difference between implementing an interface and overriding virtual methods! ! !
4. C# What is the meaning of parameter with this (extension method)
Introduction: Extension methods enable you to "add" methods to an existing type without having to create a new derived type, recompile, or otherwise modify the original type. An extension method is a special kind of static method, but can be called like an instance method on an extension type. For client code written in C# and Visual Basic, there is no significant difference between calling an extension method and calling the method actually defined in the type.
5. Use Override and New keywords for version control (C# Programming Guide)
Introduction: That 2>/dev/null is if your command goes wrong, the error report is direct. The C# language is specially designed to facilitate communication between base classes and derived classes in different libraries. Version control can continue to evolve forward while maintaining backward compatibility. This has many implications. This means, for example, that introducing a new member in a base class with the same name as a member in a derived class is fully supported in C# and will not lead to unexpected behavior. It also means that the class must explicitly declare whether a method overrides an inherited method or is a new method that hides a similarly named inherited method.
Introduction: An interface defines the syntax contract that all classes should follow when inheriting from the interface. The interface defines the "what" part of the syntax contract, and the derived class defines the "how" part of the syntax contract.
7. C# Learning Diary 26---Interface Type
Introduction: An interface contains the definition of a set of related functions that a class or structure can implement. For example, using an interface allows you to include behavior from multiple sources in a class. Since the C# language does not support multiple inheritance, multiple inheritance can be achieved through interfaces. In short, the interface only contains the declaration of members (properties, events, indexers). How the definition of a member is implemented is determined by its derived class.
8. C# Learning Diary 22---Multiple Inheritance
##Introduction: Inheritance is one of the most important concepts in object-oriented programming. Inheritance allows us to define a class based on another class. When a class is derived from another class, the derived class inherits the characteristics from the base class
9. Java's instanceof keyword simple example
# Introduction: instanceof maintains the concept of type, it refers to Is: "Are you this class? Or are you a derived class of this class?"
10.
Introduction: An interface defines the syntax contract that all classes should follow when inheriting from an interface. The interface defines the "what" part of the syntax contract, and the derived class defines the "how" part of the syntax contract.
[Related Q&A Recommendations]:
About C++’s virtual method issuesc++ - Inherited access of derived classesc++ In public inheritance, private members can only be accessed through the base class interface. If I force the derived class to a base class, can I access its base class private members? Members#c++ - Can functions with the same name with different parameters in a derived class be declared as virtual functionsc++ - Why are the operators overloaded in the derived class? Can't be used on base class objects?
The above is the detailed content of 10 recommended articles about derived classes. For more information, please follow other related articles on the PHP Chinese website!