A property which is not true for classes [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am facing the question in below (especially C++)
A property which is not true for classes is that they
(A) are removed from memory when not in use.
(B) permit data to be hidden from other classes.
(C) bring together all aspects of an entity in one place.
(D) Can closely model objects in the real world.
Could anyone explain me about meaning of that question?
What is property for classes?
I am new in C++, so if this question is posted anywhere, kindly inform me.
Thank you!

In order: No. Yes. Maybe. Hopefully.

Could anyone explain me about meaning of that question?
The question gives four "properties" (or traits) of things:
a) are removed from memory when not in use.
b) permit data to be hidden from other classes.
c) bring together all aspects of an entity in one place.
d) can closely model objects in the real world.
Your task is to identify at least one of those four choices which does not apply to the programming concept called a class.

This question is asking about (not necessarily in this order):
Real-world modeling
Garbage collection
Encapsulation
Interfaces

Related

what's a clean and efficient way of connecting objects to each other [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Feels like a question that has been asked before but I'm not exactly sure how to properly word it in a google search. Say I have a MainWindow object and in that object I define several objects PanelA, PanelB, PanelC and PanelD. What's a good way of connecting these objects to each other without having constructors that look like this
PanelA(PanelB* b, PanelC* c, PanelD* d)
Would you suggest to just pass them all in through the main class like so
PanelA(MainWindow* mw)
{
b=mw->b; c=mw->c; d=mw->d;
}
Or is there better ways to structure my classes. What's this problem known as in general, so that I can google this stuff myself.
What's this problem known as in general, so that I can google this stuff myself.
The design defect is known as strong coupling of types and use of hardcoded relations.
The general approach to refactor such code is to introduce interfaces and design patterns to solve the actual dependencies by means of functionality.

C++ one singleton Application object [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
This is basically what i am now using a lot in my application for accessing objects that needed to be accessed from many classes:
Application::getInstance()->getComponentList()
Still think that this is not the good way how to access objects that need to be shared among many classes.
Question is if there is better approach to share objects in big application.
I have to agree with you and juanchopanza: accessing objects via a single singleton object throughout an entire project is a poor practice since modules are supposed to have few and well-stated dependencies among them (ideally: interfaces or means of communication).
Also: it's easy to violate the single responsibility principle.
There's no "do X instead of the singleton approach" solution, or no silver bullet: sometimes a singleton can really be useful but if possible: avoid it and design a clear interface instead.
Also: there isn't enough information in your question to state something more specific.

Copy control for pointers in string [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
So I have this test and while studying I came up with the following question that I don't even understand (nor the question or the answer)
I know coding, I just don't understand all the nonsense they try to teach us.
So the question is:
Q: The class string has pointers to an array of char. Which of the three copy control solutions for pointers, does the class must define?
A: value_like semantics
I do know that string is an array of chars, but I don't know what are "copy control solutions", I'm not even sure what is copy control (copy constructor maybe??) and what is value_like semantics??
Hope the question makes sense, it was translated from Hebrew.
Thanks for your help :)
"Copy control solutions" probably refers to implementation strategies for copy constructor and copy assignment. I would assume that your textbooks at some point list the three solutions for pointers, given the peculiarly specific wording of the question.
Therefore, look them up and understand what they are about. Knowing how to implement copying for resource-managing objects is one of the most essential language-specific skills for a C++ programmer.

JSF multiple kinds of objects in a datatable [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I wanna know how can i put in a datatable multiple kinds of objects. I have stored in a database objects of many types. I have to show them in a datatable.
Can anybody tell me how can i do it?
att,
Diego Sabino
I had a similar situation, I thought of two options.
Adapter/Wrapper object for all different objects, and use wrapper methods to show data.
Let objects implement an interface and use that interface methods to pull relevant information for datatable.
Hope this helps.

Is there a "generics-like" feature in C++? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm trying to create a list class in C++ similar to the lists in Java. Is there a way I can have it be able to list whatever object it wants to? The class resizes arrays to create the list, but what I need to do is find out the kind of object that's needed to store.
Yes, C++ has templates that can be used to create generic containers roughly similar to Java generic containers.
While your immediate reaction might be to assume that std::list is similar to a Java list, that would be a mistake. In Java, a list basically just means a sequence. In C++, a std::list is a linked list (which is rarely useful). Most of the time you want to use an std::vector (which is more like Java's ArrayList).
Yes, there is, and it's called Templates