[** Get started **] Visual C # Basic programmer Problems

Source: Internet
Author: User
  1. SetWhat is the name of the implicit parameter of the method?
    Value. Its type is the same as that of its attribute.

  2. In C #?
    Add a colon after the class name and the name of the base class.
  3. C #Does it support multiple inheritance?
    Not supported. It can be implemented through interfaces.
  4. ProtectedModified attributes/Where can the methods be accessed?
    It can be accessed in the subclass that inherits or indirectly inherits from this class.
  5. Will private members be inherited?
    Yes, but cannot be accessed. So it seems that they cannot be inherited, but they are actually inherited.
  6. Please describe the modifier protected internal.
    Properties/Methods Modified by protected internal can only be accessed in its subclass in the same Assembly.
  7. C #Provides a default non-parameter constructor. When I implement another constructor with a parameter, I want to retain this non-parameter constructor. How many constructors should I write?
    Two. Once you implement a constructor, C # will no longer provide the default constructor. Therefore, you need to manually implement the non-parameter constructor.
  8. C #What is the common base class of all objects in?
    System. Object.
  9. What is the difference between heavy load and overwriting?
    Overload provides the implementation of calling different parameters for a method signature. Overwriting provides the implementation of modifying the behavior of the parent class method in the subclass.
  10. In method definition, virtualWhat does it mean?
    The virtual method can be overwritten by the quilt class.
  11. Can I override non-static methods into static methods?
    No. The signature of the overwriting method must be consistent with that of the overwriting method, except for changing virtual to override.
  12. Can I override a private virtual method?
    No, or even the sub-classes cannot access the private methods in the parent class.
  13. Can a class be prevented from being inherited by other classes?
    Yes. Use the keyword sealed.
  14. Can a class be inherited, but cannot a method be overwritten?
    Yes. Mark this class as public and the method as sealed.
  15. Abstract class)?
    A class that cannot be instantiated. Abstract classes generally contain abstract methods. Of course, they can also be implemented. An inherited class can be instantiated only when abstract methods of all abstract classes are implemented.
  16. When must a class be declared as an abstract class?
    When this class contains abstract methods, or the class does not fully implement the abstract methods of the parent class.
  17. Interface) What is it?
    Class that only contains a total of abstract methods. These methods must be implemented in the subclass.
  18. Why cannot I specify a modifier for a method in an interface?
    The methods in the interface are used to define the contract for communication between objects. It is meaningless to specify the methods in the interface as private or protected. They are public methods by default.
  19. Can I inherit multiple interfaces?
    Of course.
  20. What if there are repeated method names in these interfaces?
    In this case, you can decide how to implement it. Of course, you must be very careful. However, there is no problem in the compilation process.
  21. What is the difference between an interface and an abstract class?
    All methods in the interface must be abstract and the access modifier of the method cannot be specified. Abstract classes can be implemented by methods, or you can specify the access modifier of methods.
  22. How do I distinguish between overload methods?
    Different parameter types, different parameter numbers, and different parameter order.
  23. ConstAnd readonlyWhat is the difference?
    The const keyword is used to declare the compilation frequency, and readonly is used to declare the runtime frequency.
  24. System. StringAnd system. stringbuilderWhat is the difference?
    System. String is an unchangeable String. System. StringBuilder stores a variable string and provides some methods to modify the string.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.