first class

 

 

A class is defined as follows:

	class name_of_class {
		instance variable(s);
		method(s);
	} //end of class 

Write a class called circle which has three   instance  variables center( x,y ) and radius with two methods area and circumference.

You should have 3 constructor methods

 

Whenever an overloaded function is called, the function which matches the call is the one that is executed (Dynamic Method Lookup).

 

 

 

 

Now, outside of the class, perhaps in a Main routine, you can create an object which is an instance of a class. To create a new object, you instantiate it. e.g.

        ClassName object_name  = new ClassName();

Now, still outside of the class, perhaps in a Main routine, to invoke a method of a class object, specify the object name, a dot ".", and then the method name. For example:

 object.method();

 

Implement the class  in the main part. Create 3 objects and use all the methods.