initalise?


I am trying to remember how something is called, it may be initialise but cannot remember for certain, it is when i have a class made in its own .cpp but in the main file i wish to use code from the class .cpp so say the class is Circle, i would put in main

Circle circle

So i could then use circle to use functions in the class .cpp

What is this actually called, the Cicle cirle part.

Sorry this might be written making it a bit difficult to understand
closed account (48T7M4Gy)
Circle circle declares a variable circle of type Circle.

And depending what the attributes of a circle object are, and let's say a Circle has a single attribute of its radius then, Circle circle(123) would be a possible way of initialising a Circle object named circle which has a radius of 123 units.

Depending again on the Circle class there might be a setRadius(int aRadius) method whereby the radius can be set at any time once the circle is declared.

And there could be a default constructor that would initailise the radius as a default value if none is specified.
Last edited on
Topic archived. No new replies allowed.