-
Notifications
You must be signed in to change notification settings - Fork 0
/
nestclass.cpp
75 lines (59 loc) · 1.44 KB
/
nestclass.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <iostream>
#include <string.h>
using namespace std;
class student
{
private:
int roll;
char name[32];
char branch[32];
class address
{
private:
int houseno;
int pancode;
char street[32];
char city[32];
public:
void set(int h, int p, const char *s, const char *c);
void display();
};
address add;
public:
void set(int h, int p, const char *s, const char *c);
void data(int r, const char *n, const char *b);
void output();
};
void student :: address :: set(int h, int p, const char *s, const char *c)
{
houseno = h;
pancode = p;
strcpy(street, s);
strcpy(city, c);
}
void student :: address :: display()
{
cout << "house no.: " << houseno << endl << "pancode: " << pancode << endl << "street: " << street << endl << "city: " << city << endl;
}
void student :: set(int h, int p, const char *s, const char *c)
{
add.set(h, p, s, c);
}
void student :: data(int r, const char *n, const char *b)
{
roll=r;
strcpy(name,n);
strcpy(branch,b);
}
void student :: output()
{
cout << "roll no: " << roll << endl << "name: " << name << endl << "branch: " << branch << endl;
add.display();
}
int main()
{
student std;
std.data(23, "rt", "ee");
std.set(234, 2345, "28kilo", "dhulikhel");
std.output();
}