Похожие чаты

Also why does your area method need any parameters?

13 ответов

16 просмотров

That's because these methods will accept some values from the user to calculate the area and volume of the shape

Daisuke Kambe
That's because these methods will accept some valu...

Why would your area and volume methods accept values from user?

Manav | avoid unnecessary messaging me
Why would your area and volume methods accept valu...

Okay all the child classes has a getter and setter for user input

Daisuke Kambe
Okay all the child classes has a getter and setter...

The user will provide some input, the area and Volume will use this input to calculate the area and volume

Manav | avoid unnecessary messaging me
Exactly.

What exactly does getters and setters do? As per my knowledge getters returns the value of class members And setters set the value of class members

Daisuke Kambe
What exactly does getters and setters do? As per ...

Getters get the member variables, setters set the member variables. It's just a name for methods which do these

Manav | avoid unnecessary messaging me
Getters get the member variables, setters set the ...

Yeah and for calculating the area and Volume I need to pass these members

Daisuke Kambe
Yeah and for calculating the area and Volume I nee...

Again why would you want to pass these parameters to area and volume? member functions (methods) already have access to members variables

Daisuke Kambe
Yeah and for calculating the area and Volume I nee...

class A { // member variables double my_member_variable_of_A; // method (member functions) void fun() { my_member_variable_of_a = 5.0; // see you can access them here } double another_method() { return my_member_variable_of_a; } }

Ohh okay if a method is defined within class scope it doesn't need to have parameters for accessing the members variables got it

Daisuke Kambe
Ohh okay if a method is defined within class scope...

That is a weird way if phrasing it but, yeah. A class's methods can access it's member variables and even other methods it has.

Manav | avoid unnecessary messaging me
class A { // member variables double my_membe...

Btw @Dabjazz the another_method() is a getter for my_member_variable_of_a It is not a good coding practice to have these weird names for getters though.

Похожие вопросы

Обсуждают сегодня

30500 за редактор? )
Владимир
47
any reference of this implementation?
BitBuddha
29
Ⓐrtto, [4/23/24 7:02 PM] Please explain more fully how it is not working exactly, and what are the steps you are taking, and what error messages come or what happens. Ⓐrtto, ...
Ezza Kezza
2
sounds like people have lost their kaspa on tradeogre... does this mean tradeogre not trustworthy?
Ezza Kezza
15
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Alex Sherbakov
5
So much speculation in the last week. So much volatility in price. This is because Hedera has a GC that isn't using the network it's governing. Why aren't people asking why a...
Summit Seeker R
8
Anyone else having this error when trying to make transactions?
Datzel
11
Question: How viable is it to use Anvil as the backend infrastructure for managing a TradFi portfolio, while integrating Flexa for instant liquidity and payment solutions? Cou...
Kevin
2
вы делали что-то подобное и как? может есть либы готовые? увидел картинку нокода, где всё линиями соединено и стало интересно попробовать то же в ddl на lua сделать. решил с ч...
Victor
8
Карта сайта