Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,163,953 members, 7,855,857 topics. Date: Monday, 10 June 2024 at 10:33 AM |
Nairaland Forum / Science/Technology / Programming / Software/Programmer Market / Need Help In C++ (510 Views)
Please I Need Somone Very Good In C++ Urgently. / Programmer In C# Needed / Programmers In C++ Needed Urgently (2) (3) (4)
Need Help In C++ by phoxnes234: 2:35am On Nov 10, 2013 |
Can someone please explain the difference between getter setter function and constructor? I think since both getter setter and constructor objectives are to initialize private member variable in a class. I'm kind of confused because they both are doing this same thing. Is there a particular situation where each it used, or can they be used interchangeably? |
Re: Need Help In C++ by Nobody: 7:10pm On Nov 10, 2013 |
phoxnes234: Can someone please explain the difference between getter setter function and constructor? I think since both getter setter and constructor objectives are to initialize private member variable in a class. I'm kind of confused because they both are doing this same thing. Is there a particular situation where each it used, or can they be used interchangeably? They are a lot of stuffs that does the same thing, I think its just to create enuf options ... For example there is no mch difference BTW switch and using if statements, structs , union and classes are almost the same also etc |
Re: Need Help In C++ by Nobody: 6:25am On Nov 13, 2013 |
constructor is only called once during initialization and that if the entity itself require values to be set upon instantiation while setters and getters are meant mutate the private details; you shud read from learncpp.com its easier. |
Re: Need Help In C++ by 2mNaira: 3:53am On Nov 15, 2013 |
constructors are called only when objects of ur d class are created.They are used to specify various ways of creating objects of d class.Getter functns are used to get or retrirve curren values of f member varuables of d object at any time after d object has been created.Whereas setter functions are used to update d values of member variables at any time after d object has been created. |
(1) (Reply)
Nigerian Payment System Integration / A Developer Needed / Complete School Academic Management & School Accounting Systems Available.
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11 |