Can someone tell me the error in the program below.
#include <iostream> using namespace std; class A { public: typedef int count; static count cnt ; }; count A::cnt = 0; int main() { return 0; }
count does not name type
You will need to use A::count A::cnt = 0; since your typedef is defined within class A.
A::count A::cnt = 0;
i.e. either move the typedef outside the class, or use the scope resolution as above.
Your typedef is inside your class and as such is not available in the world.
typedef
You need
#include <iostream> using namespace std; typedef int count; class A { public: static count cnt ; }; count A::cnt = 0; int main() { return 0; }
Source: https://habr.com/ru/post/1483529/More articles:Preventing login attempts with curl / http post in spring application - javaNeed oracle function to convert string to byte array - oracleCustom Ningher Bindings + Decorators - c #Unable to get url from routes without request in Play app - scalaHow do I change the deployment URL in a sharepoint hosted application later? - deploymentMsiInstallProduct () starts msiexe.exe, but in 32-bit mode? - c #django-compressor: disable caching using precompilers - djangoExpress advanced options - node.jsmysql does not start in XAMPP UBUNTU - phpVariable visibility when defining functions inside functions with q - kdbAll Articles