Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Refactor a Coordinate Struct | Composition, Inheritance, and Refactoring
C# OOP Class Construction Drills
セクション 4.  4
single

single

bookChallenge: Refactor a Coordinate Struct

メニューを表示するにはスワイプしてください

タスク

スワイプしてコーディングを開始

Refactor the provided Coordinate struct into a class and add a method to calculate the distance to another Coordinate object.

  • Replace the struct with a class named Coordinate that has X and Y properties.
  • Implement a constructor that accepts values for X and Y.
  • Add a method named DistanceTo that takes another Coordinate object as a parameter and returns the Euclidean distance between the two coordinates.
  • The distance is calculated as the square root of the sum of the squared differences of the X and Y values.

解答

Switch to desktop実践的な練習のためにデスクトップに切り替える下記のオプションのいずれかを利用して、現在の場所から続行する
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 4.  4
single

single

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

some-alt