Tuesday, 20 April 2021

Constructor in C++ - 3

 #include<iostream.h>

#include<conio.h>

class A

{

public:

A()

{

cout<<"Default"<<endl;

}

A(int a)

{

cout<<"P-C"<<endl;

}

~A()

{

out<<"D-A"<<endl;

}


};

main()

{

clrscr();


A ob;

{

A ob1;

A ob2(6);

}


getch();

return 0;

}

Constructor in C++ - 2

 #include<iostream.h>

#include<conio.h>

class A

{

public:

int a , b;

A(int a,int b)

{

this->a=a;

this->b=b;

cout<<this->a+this->b<<endl;    //14

}

};

int main()

{

clrscr();

A ob=A(6,8);

cout<<ob.a+ob.b<<endl;  //garbage

getch();

return 0;

}

Constructor in C++ - 1

 #include<iostream.h>

#include<conio.h>

class A

{

public:

int a , b;

A()

{

a=5;

b=6;

}

A(int x,int y)

{

a=x;

b=y;

}

A(A &k)

{

cout<<"Copy Constructor"<<endl;

cout<<k.a+k.b<<endl;

}

};

int main()

{

clrscr();

A ob;

A ob3=A();

//ob.A();

A ob1(8,9);    //implicit

A ob2=A(10,15);          //Explicit

cout<<ob2.a+ob2.b<<endl;  //25

cout<<ob.a+ob.b<<endl;  //11

cout<<ob1.a+ob1.b<<endl;  //17

cout<<ob3.a+ob3.b<<endl;  //11

A ob4(ob);   //11

A ob5=ob2;    //25

A ob6=A(ob1);    //17

//cout<<ob4.a+ob4.b<<endl;   //11

//cout<<ob5.a+ob5.a<<endl;   //25

getch();

return 0;

}

Monday, 19 April 2021

Class and Object

 #include<iostream.h>

#include<conio.h>


class First

{

int a;


}f4,f5;

First f2;

class First f3;

int main()

{

clrscr();

class First f;

First f1;

cout<<sizeof(f);

getch();

return 0;

};




#include<iostream.h>

#include<conio.h>

class First

{

// public:

// int a=5;

  int a;

  public:

  void show();        //member function prototype

  void display()     //Implicit

  {

   a=10;

   cout<<"In display a="<<a<<endl;

  }

};

void First :: show()            //Explicit

{

a=5;

cout<<endl<<a<<endl;

}

int main()

{

clrscr();

First f;

f.show();

f.display();

getch();

return 0;


}




#include<iostream.h>

#include<conio.h>

class First

{

public:

   First()

   {

   }

   First(int a){};

   First(int a,int b)

   {}

};

int main()

{

clrscr();

First f1;

First f=First();


First f2(5);           //Implicit

First f3=First(8);     //Explicit


First f4(6,7);

First f5=First(8,9);

getch();

return 0;


}

Sunday, 18 April 2021

18 April 2021 Test Result

 

S.No.

Name

Marks

1

Salvi Vatsa

40

2

Ankur Bhardwaj

39

3

Vikas Patel

38

4

Manasi Adhikary

36

5

Suruchi Sethi

35

6

Niharika

35

7

Aarti

35

8

Manish Garg

34

9

Pritam Kumari

34

10

Govind Yadav

34

11

Bhagwana Ram Meghwal

34

12

Priya Chaurasia

32

13

Rakesh Dhankhar

31

14

Karan

30

15

Priyanka Yadav

30

16

Sonika Beniwal

30

17

Kavita

30

18

Harshita

30

19

Meera Yadav

30

20

Shahib

30

21

Ajay Gupta

30

22

Shehbaz

30

23

Shivani Singh

29

24

Shefali

29

25

Dilip Gupta

29

26

Chirag Kashyap

29

27

Akshay Sharma

29

28

Yash Kumar Sharma

28

29

Pragati

28

30

Preeti

28

31

Skm1

28

32

Manish Kumar Garg

28

33

S. Bhardwaj

27

34

Himanshu

27

35

Divya ...

26

36

Garima Batra

26

37

Annu

26

38

Pragya Sharma

26

39

Rahul

25

40

Poonam Yadav

25

41

Rohit Kumar

25

42

Jitender

25

43

Ankit Pandey

25

44

Manoj Kumar

24

45

Richa Dubey

24

46

Artee Sikarwar

24

47

Suhail Malik

24

48

Gopal Sharma

24

49

Gaurav

23

50

Anil Yadav

23

51

Mukesh Roy

23

52

Ajay Kumar

23

53

Ashish Swami

22

54

Ravina Dahiya

22

55

Manu

22

56

Monika Yadav

22

57

Sanjay

22

58

Piyush Kumar

22

59

Rohit

21

60

Sunny

21

61

Shalu

21

62

Vijay Kushawah

21

63

Anuj Kashyap

21

64

Chandan

20

65

Md Tehran

20

66

Sandeep Kumar

20

67

Rahul Kumar Singhal

19

68

Priyanka Soni

19

69

Jyoti Malik

19

70

Mittu Sharma

19

71

Sanjeev

19

72

Ranjeet Yadav

19

73

Jeetlal

18

74

Hemant Kumar Singh

17

75

Rajanj

17

76

Vipin Kumar

17

77

Lalit Gupta

16

78

Rajesh Kumar

15

79

Satyam

15

80

Rajendra

7