0

for what are assignment operators and objects used for in C++.....??????

27th Apr 2017, 8:12 AM
Paavan Gupta
Paavan Gupta - avatar
4 Answers
+ 8
Every variable is a memory space defined by four main properties: address, datatype, name and value. When you use assignment operator it locates value to the right of = sign into the memory space which can be accessed by the name (or pointer) to the left of it When it comes to object-oriented programming you will be able to create your own data types and every instance (again memory space) of that class is an object
27th Apr 2017, 8:41 AM
Dinmukhamed Mailibay
Dinmukhamed Mailibay - avatar
+ 1
You need the assignment operator to assign a ( new ) value to a variable. An object is an instance of a class or a struct. You use objects to encapsulate data and behaviour that operates on this data. It's called objectoriented programming. e.g. You have a class Person, and then you create an instance of the class. Like that: class Person{ public: string name; } int main() { //create a Person Person spiderman; /*then you use the assignment operator to assign a value*/ spidername.name = "Peter Parker"; } It's not the best example but I hope you get an idea for what these things are used for.
27th Apr 2017, 8:44 AM
lulugo
lulugo - avatar
+ 1
So much Thanks to all of you for helping me... !!..No"lulugo" it was a really helpful example
27th Apr 2017, 8:52 AM
Paavan Gupta
Paavan Gupta - avatar
0
assignment operators- used for storing values onto variables. objects - instance of a class ,used when you want to create different elements with the same properties but different values.
27th Apr 2017, 8:34 AM
Nantha
Nantha - avatar