PROGRAM USING ACCESS MODIFIERS TO DOSPLAY OBJECT DETAILS. and PROGRAM ILLUSTRATES INVOKING CLASS MEMBERS B VIA OBJECTS(INSTANCES)
You can support us by subscribing our channel 👉🏼 :- Subscribe
SHARING IS CARING
If our Website helped you a little, then kindly spread our voice using Social Networks. Spread our word to your readers, friends, teachers, students & all those close ones who deserve to know what you know now.
Constructor.txt
class ABC
{
int data; // it should be an integer value.
public: ABC() //default constuctor // classname and constuctor name
should be same
{
cout<<" this is default constructor";
}
ABC(int a) // single argument constructor //type 2
{
cout<<" this is parameterized constructor";
data=a;
cout<<"value of data is"<
EMPTY CONSTRUCTOR Copy Constructor.txt
EMPTY CONSTRUCTOR
It is a constructor with no parameters
SYNTAX:
ABC::ABC()
{};
COPY CONSTRUCTOR
It is a constructor with single of its same type that
assigns to every class member variable of the object
a copy of that obj is passed
class ABC
{
private: int data;
public: ABC()
{
ABC(int value)
{
data=value;
}
ABC(ABC &obj)
{
data=obj.data;
cout<<"copy constuctor invoked";
}
};
void main()
{
ABC obj1(50);
ABC obj2;
ABC obj3(obj1); //invokes copy constructor
obj2=obj1; // invokes copy constructor
}
IMP C++ Questions.txt
1)BEFITS OF OOPS
2) FEATURES OF OOPS
3) CLASS , METHOD AND OBJECT
4)INHERITANCE POLYPHORMISM
5) PROGRAM BASED ON CLASS DEFINITION
6) PROGRAM BASED ON ACCESS SPECIFIERS
7) PROGRAM BASED ON INVOKING CLASS MEMBERS VIA OBJECT
8) PROGRAM BASED ON POINTERS
9) PROGRAM USING ARRAY OF OBJECTS
10) CLASSES VERSUS STRUCTURES
11) NESTED CLASSES
12) CONSTRUCTOR
13) DEFAULT CONSTRUCTOR AND PARAMATERIZED CONSTRUCTOR
14)OVERLOADING
15) EMPTY CONSTRUCTOR AND COPY CONSTRUCTOR
16) TYPES OF INHERITANCE
comment 0 Comments
more_vert