Need help in c++.
Hi,
I have completed C last year and now starting studing C++. Can anyone help me please..😕
I have completed C last year and now starting studing C++. Can anyone help me please..😕
Replies
-
Manish GoyalHow can we help?
-
PensuWhat kind of help exactly do you want?.......specify...
-
BCA_GIRLHi,
I am confused about "classes in C++". Please provide me notes of this topic or expain it to me. In wait of your reply.......... -
Manish GoyalClasses are soul of oops
its a large topic no one can explain in single post
please explain where are you getting confused? -
BCA_GIRLI need a program that illustrates "structure and classes".
-
PensuCheck the following link. It may help you.
#-Link-Snipped-# -
sushant005Let me explain you what is class?
In the simple sense we can say that class is a logical concept.It means that it has no existence without an object.
Now what is a object?
Object is physical concept or we can say that it is the instance of class or we can say that object has a state and behavior.
As class is logical concept it does not allocate any memory unless an object is created.
Class is same as the structure or you can say that it is the next step to the structure and build with some extra features than structure.
struct book
{
char name;
float price;
char author;
}b;
If you consider the above program here structure are no going to take memory.It is just a form of structure data type struct book unless you do not create any structure variable i.e b it does not take any memory space.Like wise in class concept when we are create/ declare object then only it takes the memory space for the data members defined within the class.
The major difference between the structure and the class is that Structure is by default public and class is by default private.
You will better understand class with the concept of OBJECT.
If you have any doubt feel free to ask any question regarding this! -
Manish GoyalNice explanation sushant,
one more difference to add
In case of classes data hiding is possible where as in case of structures data hiding is not possible which is one of the drawback of structureS
Here data hiding means "The object know only about data that it needs to know" -
sushant005One more difference and i think this difference clear idea about the class and the structure.
Class is logical concept where as structure is a physical concept.
Here is the program clears the idea about structure,
#include
Here in the above program the struct is defined outside the main().And one thing to notice is that there is no struct variable declared but it shows the size of the struct node.It proves that it is a physical concept since without declaring the structure variable it take memory space.But that is not in the case of class is totally logical unless we create an object it is no going to take any memory space.
struct node
{
int a;
};
void main()
{
cout<<"output="<}
here the code for the class,
#include
#include
class A
{
public:
int a;
};
void main()
{
A a;/*here object is created and this allows to take the memory space for the class variable.
unless you create object class has no existence*/
cout<<"Size of A="<getch();
} -
Morningdot HabluNice explanation sus.
Looks like you also gonne cody now. -
PraveenKumar PurushothamanA simple explanation would be this way... Hope so... 😀
You are reading an archived discussion.
Related Posts
A bespoke filtration solution jointly developed by major oil industry chemical supplier, Champion Technologies, together with 3M’s Oil & Gas business, has significantly reduced the potential risk of blockage in...
Hi Everybody! I'm yunus reha,ı'm study electrical electronical engeneering in Turkey.
I stumbled upon the Samsung Wave, Samsung's first BADA powered smartphone and I got hooked to it for almost 15 minutes. I searched the Internet for information about BADA and...
A company in Norway, Opera Software (Pyra Labs) the makers of Opera (the world's fastest browser) has had guts to take on the big guys out there in browser market...
Following video shows steps to unlock the iPhone 4 -
[video=youtube;_5cvPyVGzgU]https://www.youtube.com/watch?v=_5cvPyVGzgU[/video]