0

Where is function body of Getname? Or setName()?

In previous chapter I learned about chapter, where we 1st define function body( type, veriables, statements, etc) then in main function we give function name, which help to direct the control flow of program. class myClass { public: void setName(string x) { name = x; } string getName() { return name; } private: string name; }; but here I saw few function, but no body, so could you tell me please, how it works.

8th Apr 2018, 1:00 PM
Vinay M
Vinay M - avatar
1 ответ
0
An example of setter and getter un java public class Vehicle { private String color; // Getter public String getColor() { return color; } // Setter public void setColor(String c) { this.color = c; } }
9th Apr 2018, 12:47 AM
Adrián Hernández Tipa