Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I didn't understand the question so can someone please explain with an answer?

What I have tried:

I tried to think but I didn't understand the question.
Posted
Updated 24-Jan-22 6:23am
v2
Comments
jeron1 24-Jan-22 10:20am    
What good is an answer if you don't understand the question?

(Assuming you are using C++) The requirement is to design (and implement) a class featuring a single (public) method. Then create an object (an instance) of such a class and invoke the public method on the created object.
See, for instance Classes (I) - C++ Tutorials[^].
 
Share this answer
 
To expand on what CPallini has - rightly - said:

1) Create a new class. (The link he gave will show you how to do that). Call it "MyClass"
2) Add a public method to your new class. Call it "Hello".
3) Make the Hello method do something - print "Hello World!" for example.
4) In your Main method, create an instance of the class.
5) Use the instance to call the "Hello" method.
6) Compile and test your app.

Total effort: maybe a dozen lines of code? (And some of them are just curly brackets ...)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900