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)
course content

Contenido del Curso

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?

Selecciona la respuesta correcta

¿Todo estuvo claro?

Sección 3. Capítulo 7
course content

Contenido del Curso

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?

Selecciona la respuesta correcta

¿Todo estuvo claro?

Sección 3. Capítulo 7
some-alt