0% found this document useful (0 votes)
18 views3 pages

Constructor

Uploaded by

Aman Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Constructor

Uploaded by

Aman Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

// Constructor

#include<iostream>

using namespace std;

class student

public:

student()

cout<<"constructor is initiated";

};

int main(){

student ob;

return 0;

// scope resolution
#include<iostream>

using namespace std;

int j=10;

int main(){

int i = 20;

cout<<"local variable i ="<<i<<"\n";

cout<<"global variable j ="<<j<<"\n";

return 0;

// Types of Constructor

#include<iostream>
using namespace std;

class ConstructorTest{

public:

ConstructorTest()

cout<<"constructor created";

};

int main(){

ConstructorTest ob;

return 0;

You might also like