0
When i try to make a function in private and define it outside class it gives me error why so??
class abc { private : void disp(); //some code }; void abc :: disp() { //some code }
4 Answers
+ 2
If you want to access the method from outside the class, then you must use public instead of private.
+ 1
You cannot access private methods from outside. At all. What you could do is make a public method to access the private method.
0
so if at all i want to declare a function in private i will have to define it there in the class in private itself right??
- 1
This works with my compiler.