Like the title says; Why would you want to make class objects (instances of a class) instead of built in types parameters of a function and in C . E.g. Why do this: class Person { public: void SetAge(Person &Age); instead of this: class Person { public: void SetAge(int iAge);. I don't really understand why don't you create parameters using only built in data types.
Tlotleng
0
Newbie Poster
Recommended Answers
Jump to Postclass Address // Assumes address is in USA { private: std::string street; std::string city; std::string state; std::string zipcode; public: const std::string& getStreet() const; const std::string& getCity() const; const std::string& getState() const; const std::string& getZipCode() const; }; class Map { . . . public: void showLocation( const Address& …
All 3 Replies
Lerner
582
Nearly a Posting Maven
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
ddanbe
commented:
Great answer!
+15
Neuman
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.