Computer Science, asked by harinisekar532002, 5 months ago



different types of derivation, depends on the originals access modifiers in c++

Answers

Answered by Mister360
0

Explanation:

Here is a code to help you understand

c++

/ C++ program to demonstrate public

// access modifier

#include<iostream>

using namespace std;

// class definition

class Circle

{

public:

double radius;

double compute_area()

{

return 3.14*radius*radius;

}

};

// main function

int main()

{

Circle obj;

// accessing public datamember outside class

obj.radius = 5.5;

cout << "Radius is: " << obj.radius << "\n";

cout << "Area is: " << obj.compute_area();

return 0;

}

Similar questions