2019.8.21 Class & Interface & Abstract & Attributes

1. Create interFace

interface ISuper

{
int GetSuper();
}

Classes can inherit multiple interfaces, or can only inherit a single abstract class.

Implementation in inherited classes

public int GetSuper()

{
return age + 100;
}

The difference between InterFace and abstract: abstract classes cannot be instantiated, they are inherited by other classes to implement specific methods, including class field abstract methods, and interfaces are rules , Cannot have member variables, fields

The creation of attributes (two types) public int Age//genus {

< span style="color: #0000ff;">get {return age + 10;} set  {age = value-10;//value is a specific member variable } }

public int ID//attributes {get; set; }

The attribute can be set to a value (default is 0):

< div class="code">

person.Age = 10;

Use of attributes:

Console.WriteLine(person.Age);


person.Age
= 10;

Today too Sleepy. Above

Good night

interface ISuper

{
int GetSuper();
}

public int GetSuper()

{
return age + 100;
}

get {return age + 10;} set {age = value-10;//value is a specific member variable } }

public int ID// Attributes {get; set; }< /span>

person.Age = 10;

Console.WriteLine(person.Age);


person.Age
= 10;

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 239 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.