Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Class Methods | Introduction to Object-Oriented Programming (OOP)
C# Beyond Basics

Class MethodsClass Methods

Just like structs, classes can also have methods. The syntax for creating and calling methods is also very similar:

For example, we can create a class called Rectangle with width and height attributes and a method called area, which calculates the area of the rectangle object based on the width and height values:

cs

index.cs

cs

index.cs

Which of the following is a valid method?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 3. Розділ 7
course content

Зміст курсу

C# Beyond Basics

Class MethodsClass Methods

Just like structs, classes can also have methods. The syntax for creating and calling methods is also very similar:

For example, we can create a class called Rectangle with width and height attributes and a method called area, which calculates the area of the rectangle object based on the width and height values:

cs

index.cs

cs

index.cs

Which of the following is a valid method?

Виберіть правильну відповідь

Все було зрозуміло?

Секція 3. Розділ 7
some-alt