Похожие чаты

Also why does your area method need any parameters?

13 ответов

18 просмотров

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.

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта