Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions a.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
the first commit
49 changes: 49 additions & 0 deletions single_level_inheritance.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//single level inheritance i.e taking one as a parent class and another as a child class
//Dtyagi-9
#include <iostream>
using namespace std;
class A
{

public:
int a,b;
A(){
a=0;
b=0;
};
A(int p,int q)
{
a=p;
b=q;
}
void getdata()
{
cout<<"enter the values in a and b \n";
cin>>a>>b;

}


};

class B:public A
{
public:

void display()
{
cout<<"THE VALUES OF A AND B ARE: \n a="<<a<<"\n b="<<b;
}
};



int main()
{

B objB;
objB.getdata();
objB.display();

return 0;
}