We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bafd06a commit bf33469Copy full SHA for bf33469
src/cpp/02 OOPS concept/11 constructor.cpp
@@ -0,0 +1,31 @@
1
+#include<bits/stdc++.h>
2
+using namespace std;
3
+
4
+class Employee{
5
+ public:
6
+ string Name;
7
+ string Company;
8
+ int Age;
9
10
+ void IntroduceYourself(){
11
+ cout <<"Name - "<<Name<<endl;
12
+ cout <<"Company - "<<Company<<endl;
13
+ cout <<"Age - "<<Age<<endl;
14
+ }
15
+ Employee(string name, string company, int age){
16
+ Name=name;
17
+ Company=company;
18
+ Age=age;
19
20
+};
21
22
23
+int main ()
24
+{
25
+ Employee employee1=Employee("Shivendra","No-company",23);
26
+ employee1.IntroduceYourself();
27
28
+ Employee employee2=Employee("Nisha","Amazon",18);
29
+ employee2.IntroduceYourself();
30
31
+}
0 commit comments