+ 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?)
20 ответов
+ 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...
+ 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!!😊
+ 3
And Kalpana Bhowal,Pritam Baisnab plz remove ur answers in which u r talking, chatting on question forum isn't good at all!!
+ 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
+ 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.
+ 1
That was helpful. Thanks.😊
0
Oky
0
Help him
- 1
Hello!
- 1
But pls help me with the ques...
- 1
woh sawal ka jawab dhundne meh madad karo...
- 1
Kolkata, India
- 2
mai New Hoon...Muje kus Samaj mai nahi ahraha hai..
- 2
tum kaha se hoo...
- 3
Reply Pls
- 3
Hii Im Preetam
- 3
tell me hindi
- 3
mai Assam india
- 3
bangla jano tahole
- 4
ok