We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Structures and Classes are very important data structures used in C / C++. You as a programmer has a choice to use any of them 
as Structures and Classes do provide features some what similar but only with some differences. Now you are given a task 
to code either using Structures or Classes. 
Please give your justification in favor or against of any one you will use for coding.

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 308

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

use classes in coding due to the following characteristics.
Structures has only data variables gathered, grouped and named as a single entity, but in classes there are both data members and as well as functions to manipulate data members.
In structures data variables are by default public and are visible to all and every one can change them. But the data members and member functions are by default are private and are not visible to every one. In classed we can make the member functions public to manipulate the data members so these are visible to every one and by making data members private we can hide them. So one cannot change the values wrongly.
The only difference between a classes and a structures in C++ is that structures have default public members and bases and classes have default private members and bases. Both classes and structures can have a mixture of public and private members, can use inheritance, and can have member functions.
I would recommend using structures as plain-old-data structures without any class-like features, and using classes as aggregate data structures with private data and member functions.

Read more: CS-201 GDB Full Solution - Virtual University of Pakistan http://vustudents.ning.com/group/cs201introductiontoprogramming/for...

I use structures only when I need to hold some data without any member functions associated to it (to operate on the member data) and to access the data variables directly.

For example:

1. Reading/Writing data from files and socket streams etc.

2. Passing function arguments in a structure where the function arguments are too many and function syntax looks too lengthy.

Technically there is no big difference between classes and strutures except default accessibility. More over it depends on programming style how we use it.



Read more: CS-201 GDB Full Solution - Virtual University of Pakistan http://vustudents.ning.com/group/cs201introductiontoprogramming/for...
Solution post by Muhammad Shafiq Mughal . Gud Muhammad Shafiq Mughal keep it up 

 All don't just copy paste.Otherwise all will be get zero marks this is just idea solution.

Structures and Classes are very important data structures used in C / C++. You as a programmer has a choice to use any of them as Structures and Classes do provide features some what similar but only with some differences. Now you are given a task to code either using Structures or Classes. Please give your justification in favor or against of any one you will use for coding.

 

Your opinion should be concrete with justification in 5 -7 lines only. 

While giving your opinion in favor or against don’t write detailed pages or paragraphs as it is discourage your answer should be to the point.  

 

 

 

 

ANSWER:

 

                Classes are better then the Structures because we can also write the pvt data in it, So by using classes we can hide over data, which I don’t want to share any body. Every thing decleared inside the structure is Public. Classes consist of and are composed from structural and also behavioral constituents. only use structs for POD types, and for add any methods at all, use classes. Use a struct instead of a class is when declaring a functor right before using it in a function call and want to minimize syntax for the sake of clarity.

ONE MORE GDB IDEA SOLUTION OF CS201
I will prefer to use classes in my coding due to the following characteristics.
Structures has only data variables gathered, grouped and named as a single entity, but in classes there are both data members and as well as functions to manipulate data members.
In structures data variables are by default public and are visible to all and every one can change them. But the data members and member functions are by default are private and are not visible to every one. In classed we can make the member functions public to manipulate the data members so these are visible to every one and by making data members private we can hide them. So one cannot change the values wrongly.

RSS

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.