Help me with encapsulation. (Context: C++) Please help me. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Help me with encapsulation. (Context: C++) Please help me.

I was going through the C++ tutorial on Sololearn and came across: This allows us to change attributes and implementation of methods without altering the overall program. For example, we can come back later and change the data type of the balance attribute. I can't understand what is said about: ••>Implementation (elaborate what it means pls) ••>"without changing the overall program" (what does it mean by overall program and why is it un"changed"?) ••>"change the data type" (how do we do it, what is it?)

27th Feb 2018, 6:38 AM
Kalpana Bhowal
Kalpana Bhowal - avatar
20 Answers
+ 7
Implementation: The interface is what you need to know about the function to call it. The implementation is everything else about the function. "Changing the overall program" means that you change something in your main function (in this context). Data type: int, float, char, string...
27th Feb 2018, 1:21 PM
Timon Paßlick
+ 3
Encapsulation in terms of oops concepts(in c++) is nothing, but the private attributes(of any class) is accessible in the class, or, to its member fuctions only and also including the friend function.Therefore attributes now have got the scope only inside the class or u can say that they are being wrapped up into the class hence this process is also called as the wrapping of data. And u saying that how can we change the data type..yes we can actually change any attribute's datatype like for example: There is a attribute salary(initially in float) in the class employee,but i want more precision..so, i will change the salary's data type as double. Now i will say u must study the c++ oops concepts carefully and thoroughly as they are one of the best and simplified oops concepts ever!! And u can ask me anything in c++ ,anytime!...happy learning!!😊
1st Jul 2019, 6:30 AM
Mohan
Mohan - avatar
+ 3
And Kalpana Bhowal,Pritam Baisnab plz remove ur answers in which u r talking, chatting on question forum isn't good at all!!
1st Jul 2019, 6:33 AM
Mohan
Mohan - avatar
+ 1
Oh...thanks...but I just wanted to ask: -why do we need to change the data type? and :-it says encapsulation helps us not to chabge overall program...why is that helpful
28th Feb 2018, 6:20 AM
Kalpana Bhowal
Kalpana Bhowal - avatar
+ 1
You might want to change for example integral types to bigger or smaller ones. And it is especially helpful when you're working in a team or for large projects.
28th Feb 2018, 6:27 AM
Timon Paßlick
+ 1
That was helpful. Thanks.😊
28th Feb 2018, 10:16 AM
Kalpana Bhowal
Kalpana Bhowal - avatar
0
Oky
29th Sep 2019, 10:13 AM
Pritam Baisnab
Pritam Baisnab - avatar
0
Help him
29th Sep 2019, 10:13 AM
Pritam Baisnab
Pritam Baisnab - avatar
- 1
Hello!
27th Feb 2018, 9:40 AM
Kalpana Bhowal
Kalpana Bhowal - avatar
- 1
But pls help me with the ques...
27th Feb 2018, 9:40 AM
Kalpana Bhowal
Kalpana Bhowal - avatar
- 1
woh sawal ka jawab dhundne meh madad karo...
27th Feb 2018, 9:43 AM
Kalpana Bhowal
Kalpana Bhowal - avatar
- 1
Kolkata, India
27th Feb 2018, 9:46 AM
Kalpana Bhowal
Kalpana Bhowal - avatar
- 2
mai New Hoon...Muje kus Samaj mai nahi ahraha hai..
27th Feb 2018, 9:45 AM
Pritam Baisnab
Pritam Baisnab - avatar
- 2
tum kaha se hoo...
27th Feb 2018, 9:46 AM
Pritam Baisnab
Pritam Baisnab - avatar
- 3
Reply Pls
27th Feb 2018, 9:39 AM
Pritam Baisnab
Pritam Baisnab - avatar
- 3
Hii Im Preetam
27th Feb 2018, 9:39 AM
Pritam Baisnab
Pritam Baisnab - avatar
- 3
tell me hindi
27th Feb 2018, 9:41 AM
Pritam Baisnab
Pritam Baisnab - avatar
- 3
mai Assam india
27th Feb 2018, 9:47 AM
Pritam Baisnab
Pritam Baisnab - avatar
- 3
bangla jano tahole
27th Feb 2018, 9:47 AM
Pritam Baisnab
Pritam Baisnab - avatar
- 4
ok
27th Feb 2018, 9:49 AM
Pritam Baisnab
Pritam Baisnab - avatar